|
|
@ -1,19 +1,14 @@ |
|
|
const { FlatCompat } = require('@eslint/eslintrc'); |
|
|
|
|
|
const js = require('@eslint/js'); |
|
|
|
|
|
const nxEslintPlugin = require('@nx/eslint-plugin'); |
|
|
const nxEslintPlugin = require('@nx/eslint-plugin'); |
|
|
|
|
|
const importPlugin = require('eslint-plugin-import'); |
|
|
const storybook = require('eslint-plugin-storybook'); |
|
|
const storybook = require('eslint-plugin-storybook'); |
|
|
|
|
|
const typescriptEslint = require('typescript-eslint'); |
|
|
const compat = new FlatCompat({ |
|
|
|
|
|
baseDirectory: __dirname, |
|
|
|
|
|
recommendedConfig: js.configs.recommended |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
module.exports = [ |
|
|
module.exports = [ |
|
|
{ |
|
|
{ |
|
|
ignores: ['**/dist'] |
|
|
ignores: ['**/dist'] |
|
|
}, |
|
|
}, |
|
|
...storybook.configs['flat/recommended'], |
|
|
...storybook.configs['flat/recommended'], |
|
|
{ plugins: { '@nx': nxEslintPlugin } }, |
|
|
{ plugins: { '@nx': nxEslintPlugin, import: importPlugin } }, |
|
|
{ |
|
|
{ |
|
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], |
|
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], |
|
|
rules: { |
|
|
rules: { |
|
|
@ -35,41 +30,15 @@ module.exports = [ |
|
|
'no-extra-semi': 'off' |
|
|
'no-extra-semi': 'off' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
...compat |
|
|
...nxEslintPlugin.configs['flat/typescript'], |
|
|
.config({ |
|
|
...nxEslintPlugin.configs['flat/javascript'], |
|
|
extends: ['plugin:@nx/typescript'] |
|
|
...typescriptEslint.config({ |
|
|
}) |
|
|
|
|
|
.map((config) => ({ |
|
|
|
|
|
...config, |
|
|
|
|
|
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'], |
|
|
|
|
|
rules: { |
|
|
|
|
|
...config.rules |
|
|
|
|
|
} |
|
|
|
|
|
})), |
|
|
|
|
|
...compat |
|
|
|
|
|
.config({ |
|
|
|
|
|
extends: ['plugin:@nx/javascript'] |
|
|
|
|
|
}) |
|
|
|
|
|
.map((config) => ({ |
|
|
|
|
|
...config, |
|
|
|
|
|
files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'], |
|
|
|
|
|
rules: { |
|
|
|
|
|
...config.rules |
|
|
|
|
|
} |
|
|
|
|
|
})), |
|
|
|
|
|
...compat |
|
|
|
|
|
.config({ |
|
|
|
|
|
plugins: ['eslint-plugin-import', '@typescript-eslint'], |
|
|
|
|
|
extends: [ |
|
|
|
|
|
'plugin:@typescript-eslint/recommended-type-checked', |
|
|
|
|
|
'plugin:@typescript-eslint/stylistic-type-checked' |
|
|
|
|
|
] |
|
|
|
|
|
}) |
|
|
|
|
|
.map((config) => ({ |
|
|
|
|
|
...config, |
|
|
|
|
|
files: ['**/*.ts'], |
|
|
files: ['**/*.ts'], |
|
|
|
|
|
extends: [ |
|
|
|
|
|
typescriptEslint.configs.recommendedTypeChecked, |
|
|
|
|
|
typescriptEslint.configs.stylisticTypeChecked |
|
|
|
|
|
], |
|
|
rules: { |
|
|
rules: { |
|
|
...config.rules, |
|
|
|
|
|
'@typescript-eslint/consistent-indexed-object-style': 'off', |
|
|
'@typescript-eslint/consistent-indexed-object-style': 'off', |
|
|
'@typescript-eslint/dot-notation': 'off', |
|
|
'@typescript-eslint/dot-notation': 'off', |
|
|
'@typescript-eslint/explicit-member-accessibility': [ |
|
|
'@typescript-eslint/explicit-member-accessibility': [ |
|
|
@ -190,5 +159,5 @@ module.exports = [ |
|
|
// and can be remove once solved |
|
|
// and can be remove once solved |
|
|
'@typescript-eslint/prefer-nullish-coalescing': 'warn' // TODO: Requires strictNullChecks: true |
|
|
'@typescript-eslint/prefer-nullish-coalescing': 'warn' // TODO: Requires strictNullChecks: true |
|
|
} |
|
|
} |
|
|
})) |
|
|
}) |
|
|
]; |
|
|
]; |
|
|
|