diff --git a/src/configs.ts b/src/configs.ts index 0a4bffe..3aea0ed 100644 --- a/src/configs.ts +++ b/src/configs.ts @@ -104,6 +104,41 @@ export async function readConfig( if (!Array.isArray(rawConfigs)) rawConfigs = [rawConfigs] + // ESLint applies these default configs to all files + // https://github.com/eslint/eslint/blob/21d3766c3f4efd981d3cc294c2c82c8014815e6e/lib/config/default-config.js#L66-L69 + rawConfigs.unshift( + { + name: 'eslint/defaults/languages', + languageOptions: { + sourceType: 'module', + ecmaVersion: 'latest', + parserOptions: {}, + }, + linterOptions: { + reportUnusedDisableDirectives: 1, + }, + } as FlatConfigItem, + { + name: 'eslint/defaults/ignores', + ignores: [ + '**/node_modules/', + '.git/', + ], + } as FlatConfigItem, + { + name: 'eslint/defaults/files', + files: ['**/*.js', '**/*.mjs'], + } as FlatConfigItem, + { + name: 'eslint/defaults/files-cjs', + files: ['**/*.cjs'], + languageOptions: { + sourceType: 'commonjs', + ecmaVersion: 'latest', + }, + } as FlatConfigItem, + ) + const rulesMap = new Map() // Try resolve `eslint` module from the same directory as the config file