ci: change eslint settings

This commit is contained in:
1ncounter 2024-04-03 14:23:23 +08:00
parent 5206715a5c
commit 1149044308
3 changed files with 33 additions and 54 deletions

View File

@ -1,18 +0,0 @@
# 忽略目录
node_modules
test-cases
test
output
build
dist
demo
es
lib
tests
.*
~*
# 忽略文件
**/*.min.js
**/*-min.js
**/*.bundle.js

View File

@ -1,40 +1,34 @@
import stylistic from '@stylistic/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import tseslint from 'typescript-eslint'
import js from '@eslint/js';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
export default [
js.configs.recommended,
{
files: ['**/src/**/*.{ts?(x),js?(x)}'],
plugins: {
'@stylistic': stylistic,
'react-hooks': reactHooks,
},
languageOptions: {
parser: tsParser,
},
rules: {
'@stylistic/indent': ['error', 2],
"@stylistic/indent-binary-ops": ["error", 2],
'@stylistic/max-len': ["error", { "tabWidth": 2 }],
'@stylistic/no-tabs': "error",
'@stylistic/quotes': ["error", "single"],
"@stylistic/jsx-pascal-case": [2],
"@stylistic/jsx-indent": [2, 2, { checkAttributes: true, indentLogicalExpressions: true }],
export default tseslint.config({
files: ['packages/*/src/**/*.{ts?(x),js?(x)}'],
ignores: ["**/*.test.ts"],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
],
plugins: {
'@stylistic': stylistic,
'react-hooks': reactHooks,
'react-refresh': reactRefresh
},
rules: {
'@stylistic/indent': ['error', 2],
'@stylistic/indent-binary-ops': ['error', 2],
'@stylistic/max-len': ['error', { tabWidth: 2 }],
'@stylistic/no-tabs': 'error',
'@stylistic/quotes': ['error', 'single'],
'@stylistic/jsx-pascal-case': [2],
'@stylistic/jsx-indent': [2, 2, { checkAttributes: true, indentLogicalExpressions: true }],
'@stylistic/semi': ['error', 'always'],
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
},
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'react-refresh/only-export-components': 'warn',
},
{
files: ['**/src/**/*.{tsx,jsx}'],
plugins: {
'react-refresh': reactRefresh,
},
rules: {
'react-refresh/only-export-components': 'warn',
},
},
];
})

View File

@ -5,10 +5,10 @@
"scripts": {
"playground": "pnpm --filter playground dev",
"test": "pnpm -r test",
"build": "pnpm -r build",
"build": "node ./scripts/build.js",
"clean": "rimraf ./packages/*/dist",
"clean:lib": "rimraf ./node_modules ./packages/*/node_modules",
"lint": "eslint --cache --no-warn-ignored",
"lint": "eslint . --cache",
"pub": "npm run watchdog:build && lerna publish patch --yes --force-publish --exact --no-changelog",
"pub:minor": "npm run watchdog:build && lerna publish minor --yes --force-publish --exact --no-changelog",
"pub:major": "npm run watchdog:build && lerna publish major --yes --force-publish --exact --no-changelog",
@ -30,16 +30,19 @@
"@stylistic/eslint-plugin": "^1.7.0",
"@types/node": "^20.11.30",
"@types/react-router": "5.1.18",
"@typescript-eslint/parser": "^7.4.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"execa": "^8.0.1",
"husky": "^9.0.11",
"less": "^4.2.0",
"lint-staged": "^15.2.2",
"minimist": "^1.2.8",
"rimraf": "^5.0.2",
"rollup": "^4.13.0",
"typescript": "^5.4.2",
"typescript-eslint": "^7.5.0",
"vite": "^5.1.6",
"vitest": "^1.3.1"
},