mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-18 01:31:47 +00:00
Replace tslint with eslint
This commit is contained in:
47
.eslintrc.js
Normal file
47
.eslintrc.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true,
|
||||||
|
},
|
||||||
|
warnOnUnsupportedTypeScriptVersion: false,
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
node: true,
|
||||||
|
es6: true,
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:react/recommended',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'no-var': 'off',
|
||||||
|
'prefer-const': 'off',
|
||||||
|
'no-case-declarations': 'off',
|
||||||
|
'prefer-spread': 'off',
|
||||||
|
'no-extra-boolean-cast': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-use-before-define': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/ban-types': 'off',
|
||||||
|
'@typescript-eslint/no-this-alias': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'react/display-name': 'off',
|
||||||
|
'react/no-unescaped-entities': 'off',
|
||||||
|
},
|
||||||
|
};
|
||||||
1842
package-lock.json
generated
1842
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -62,10 +62,13 @@
|
|||||||
"@types/md5": "^2.3.0",
|
"@types/md5": "^2.3.0",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||||
"@typescript-eslint/parser": "^4.19.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
"cypress": "^13.17.0",
|
"cypress": "^13.17.0",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"eslint-plugin-react": "^7.37.5",
|
||||||
|
"eslint-plugin-react-hooks": "^7.1.1",
|
||||||
"gh-pages": "^6.3.0",
|
"gh-pages": "^6.3.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
@@ -75,7 +78,6 @@
|
|||||||
"start-server-and-test": "^2.0.9",
|
"start-server-and-test": "^2.0.9",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tslint-config-prettier": "^1.18.0",
|
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"vite": "^6.4.2",
|
"vite": "^6.4.2",
|
||||||
"vite-tsconfig-paths": "^5.1.4"
|
"vite-tsconfig-paths": "^5.1.4"
|
||||||
@@ -89,6 +91,7 @@
|
|||||||
"build:windows": "powershell -Command \"Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; tsc; if ($?) { $env:GENERATE_SOURCEMAP='false'; $env:VITE_CHANGELOG = Get-Content -Path \"CHANGELOG.md\" -Raw; $env:VITE_GIT_SHA=$(git rev-parse --short HEAD); $env:VITE_GIT_TIME=$(git log -1 --format='%ci'); vite build }",
|
"build:windows": "powershell -Command \"Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; tsc; if ($?) { $env:GENERATE_SOURCEMAP='false'; $env:VITE_CHANGELOG = Get-Content -Path \"CHANGELOG.md\" -Raw; $env:VITE_GIT_SHA=$(git rev-parse --short HEAD); $env:VITE_GIT_TIME=$(git log -1 --format='%ci'); vite build }",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"prettier": "prettier --write src/**/*.{ts,tsx,json} && prettier --write src/*.{ts,tsx,json}",
|
"prettier": "prettier --write src/**/*.{ts,tsx,json} && prettier --write src/*.{ts,tsx,json}",
|
||||||
|
"lint": "eslint src --ext .ts,.tsx",
|
||||||
"predeploy": "npm run build",
|
"predeploy": "npm run build",
|
||||||
"deploy": "gh-pages -d dist",
|
"deploy": "gh-pages -d dist",
|
||||||
"predeploy-wikitree": "npm run build",
|
"predeploy-wikitree": "npm run build",
|
||||||
@@ -104,11 +107,5 @@
|
|||||||
"not dead",
|
"not dead",
|
||||||
"not ie <= 11",
|
"not ie <= 11",
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
]
|
||||||
"eslintConfig": {
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-use-before-define": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
62
tslint.json
62
tslint.json
@@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"tslint-config-prettier"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"array-type": [true, "array-simple"],
|
|
||||||
"arrow-return-shorthand": true,
|
|
||||||
"ban": [true,
|
|
||||||
{"name": "parseInt", "message": "tsstyle#type-coercion"},
|
|
||||||
{"name": "parseFloat", "message": "tsstyle#type-coercion"},
|
|
||||||
{"name": "Array", "message": "tsstyle#array-constructor"}
|
|
||||||
],
|
|
||||||
"ban-types": [true,
|
|
||||||
["Object", "Use {} instead."],
|
|
||||||
["String", "Use 'string' instead."],
|
|
||||||
["Number", "Use 'number' instead."],
|
|
||||||
["Boolean", "Use 'boolean' instead."]
|
|
||||||
],
|
|
||||||
"class-name": true,
|
|
||||||
"curly": [true, "ignore-same-line"],
|
|
||||||
"deprecation": true,
|
|
||||||
"forin": true,
|
|
||||||
"interface-name": [true, "never-prefix"],
|
|
||||||
"jsdoc-format": true,
|
|
||||||
"label-position": true,
|
|
||||||
"member-access": [true, "no-public"],
|
|
||||||
"new-parens": true,
|
|
||||||
"no-angle-bracket-type-assertion": true,
|
|
||||||
"no-any": true,
|
|
||||||
"no-arg": true,
|
|
||||||
"no-conditional-assignment": true,
|
|
||||||
"no-construct": true,
|
|
||||||
"no-debugger": true,
|
|
||||||
"no-default-export": true,
|
|
||||||
"no-duplicate-variable": true,
|
|
||||||
"no-inferrable-types": true,
|
|
||||||
"no-namespace": [true, "allow-declarations"],
|
|
||||||
"no-reference": true,
|
|
||||||
"no-string-throw": true,
|
|
||||||
"no-unused-expression": true,
|
|
||||||
"no-var-keyword": true,
|
|
||||||
"object-literal-shorthand": true,
|
|
||||||
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
|
|
||||||
"prefer-const": true,
|
|
||||||
"radix": true,
|
|
||||||
"semicolon": [true, "always", "ignore-bound-class-methods"],
|
|
||||||
"switch-default": true,
|
|
||||||
"triple-equals": [true, "allow-null-check"],
|
|
||||||
"use-isnan": true,
|
|
||||||
"variable-name": [
|
|
||||||
true,
|
|
||||||
"check-format",
|
|
||||||
"ban-keywords",
|
|
||||||
"allow-leading-underscore",
|
|
||||||
"allow-trailing-underscore",
|
|
||||||
"allow-pascal-case"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"linterOptions": {
|
|
||||||
"exclude": "src/**/*.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user