chore: init eslint v9

This commit is contained in:
chenshenhai 2025-09-06 13:30:13 +08:00
parent 0115eb1cfb
commit 4a23a267f2
4 changed files with 1295 additions and 66 deletions

13
.vscode/settings.json vendored
View file

@ -1,6 +1,19 @@
{
"editor.formatOnSave": true,
"eslint.format.enable": true,
"eslint.useFlatConfig": true,
"eslint.lintTask.enable": true,
"eslint.lintTask.options": "--config eslint.config.js .",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"prettier.configPath": ".prettierrc.json",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"

45
eslint.config.mjs Normal file
View file

@ -0,0 +1,45 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tsESLint from 'typescript-eslint';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginNode from 'eslint-plugin-n';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
/** @type {import('eslint').Linter.Config[]} */
export default [
pluginJs.configs.recommended,
...tsESLint.configs.recommended,
eslintPluginReact.configs.flat.recommended,
{
...eslintPluginNode.configs['flat/recommended-script'],
files: ['scripts/**/*.ts', 'babel.config.js', 'jest.*.js', 'jest.*.*.js'],
rules: {
// 'no-console': 'error'
}
},
{
// files: ['src/**/*.{js,mjs,cjs,ts,jsx,tsx}'],
files: ['packages/*/src/**/*.ts'],
languageOptions: {
globals: globals.browser,
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {}
},
plugins: {
'@typescript-eslint': typescriptEslint
},
ignores: ['node_modules'],
rules: {
semi: 'error',
'no-console': 'error',
'comma-dangle': ['always-multiline'],
'@typescript-eslint/rule-name': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unnecessary-type-constraint': 0
}
}
];

View file

@ -33,6 +33,7 @@
"@babel/core": "^7.28.4",
"@babel/preset-env": "^7.28.3",
"@babel/preset-typescript": "^7.27.1",
"@eslint/js": "^9.35.0",
"@rollup/plugin-json": "^6.1.0",
"@types/glob": "^8.1.0",
"@types/jest": "^30.0.0",
@ -48,9 +49,12 @@
"enquirer": "^2.4.1",
"esbuild": "^0.25.9",
"eslint": "^9.35.0",
"eslint-plugin-n": "^17.21.3",
"eslint-plugin-react": "^7.37.5",
"execa": "^9.6.0",
"fs-extra": "^11.3.1",
"glob": "^11.0.3",
"globals": "^16.3.0",
"http-server": "^14.1.1",
"husky": "^9.1.7",
"jest": "^30.1.3",
@ -71,6 +75,7 @@
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"typescript": "^5.9.2",
"typescript-eslint": "^8.42.0",
"vite": "^7.1.4"
}
}

File diff suppressed because it is too large Load diff