Migrate to ESLint 10 flat config
parent
b98df93775
commit
cd314193bc
@ -1,20 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
const js = require('@eslint/js');
|
||||
const globals = require('globals');
|
||||
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
||||
|
||||
const SOURCE_FILES = ['src/**/*.{js,ts}'];
|
||||
const TS_FILES = ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.mts', 'src/**/*.cts'];
|
||||
|
||||
const scopedTsConfigs = tsPlugin.configs['flat/recommended'].map((config) => ({
|
||||
...config,
|
||||
files: config.files ? config.files.map((pattern) => `src/${pattern}`) : TS_FILES,
|
||||
}));
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
ignores: ['node_modules/**', 'dist/**', 'coverage/**'],
|
||||
linterOptions: {
|
||||
reportUnusedDisableDirectives: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: SOURCE_FILES,
|
||||
languageOptions: {
|
||||
ecmaVersion: 2021,
|
||||
sourceType: 'module',
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.es2021,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...js.configs.recommended,
|
||||
files: SOURCE_FILES,
|
||||
},
|
||||
...scopedTsConfigs,
|
||||
];
|
||||
@ -1,5 +1,5 @@
|
||||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
declare let module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue