Replace tslint with eslint

This commit is contained in:
Przemek Więch
2026-04-28 23:25:05 +02:00
parent 5a1695fbc1
commit da452e8b37
4 changed files with 1280 additions and 688 deletions

47
.eslintrc.js Normal file
View 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

File diff suppressed because it is too large Load Diff

View File

@@ -62,10 +62,13 @@
"@types/md5": "^2.3.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-react": "^4.3.4",
"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",
"jest": "^29.7.0",
"jsdom": "^26.0.0",
@@ -75,7 +78,6 @@
"start-server-and-test": "^2.0.9",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tslint-config-prettier": "^1.18.0",
"typescript": "^5.7.3",
"vite": "^6.4.2",
"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 }",
"test": "jest",
"prettier": "prettier --write src/**/*.{ts,tsx,json} && prettier --write src/*.{ts,tsx,json}",
"lint": "eslint src --ext .ts,.tsx",
"predeploy": "npm run build",
"deploy": "gh-pages -d dist",
"predeploy-wikitree": "npm run build",
@@ -104,11 +107,5 @@
"not dead",
"not ie <= 11",
"not op_mini all"
],
"eslintConfig": {
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off"
}
}
]
}

View File

@@ -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"
}
}