Skip to content

Commit

Permalink
feat: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 15, 2024
1 parent 988edac commit 6b0736a
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 2 deletions.
25 changes: 25 additions & 0 deletions packages/canyon-backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
8 changes: 7 additions & 1 deletion packages/canyon-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.2"
"typescript": "^5.5.2",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.3.2"
}
}
5 changes: 5 additions & 0 deletions packages/canyon-platform/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
server.js
index.html
Dockerfile
dist
76 changes: 76 additions & 0 deletions packages/canyon-platform/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:react/jsx-runtime",
"plugin:prettier/recommended",
"prettier"
],
"env": {
"browser": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"import",
"simple-import-sort",
"jsx-a11y",
"react-hooks",
"prettier"
],
"rules": {
"react/jsx-no-undef": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"linebreak-style": "off",
"comma-dangle": [0, "always-multiline"],
"quotes": [0, "double"],
"semi": [0, "always"],
"space-before-function-paren": [0, "never"],
"multiline-ternary": "off",
"camelcase": "off",
"prettier/prettier": [
"warn",
{
"endOfLine": "auto",
"singleQuote": true
}
],
"react/prop-types": "off",
"react/display-name": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/react-in-jsx-scope": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react/no-unknown-property": ["error", { "ignore": ["css"] }],
"jsx-a11y/no-autofocus": "off"
},
"ignorePatterns": ["**/*.css","**/*.md"]
}
14 changes: 13 additions & 1 deletion packages/canyon-platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
"unplugin-auto-import": "^0.17.6",
"unplugin-auto-import-antd": "^0.0.1",
"vite": "^5.3.2",
"vite-plugin-pages": "^0.32.3"
"vite-plugin-pages": "^0.32.3",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.3.2"
}
}

0 comments on commit 6b0736a

Please sign in to comment.