Skip to content

Commit

Permalink
fix: prepend eslint default configs (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <[email protected]>
  • Loading branch information
voxpelli and antfu authored Jun 21, 2024
1 parent 919e774 commit 4ef77d9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, RuleInfo>()

// Try resolve `eslint` module from the same directory as the config file
Expand Down

0 comments on commit 4ef77d9

Please sign in to comment.