Skip to content

Commit 074d1b2

Browse files
committed
Linting update
1 parent 8ca94f8 commit 074d1b2

2 files changed

Lines changed: 613 additions & 28 deletions

File tree

applications/samples/frontend/.eslintrc.cjs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,35 @@ module.exports = {
66
'plugin:@typescript-eslint/recommended',
77
'plugin:react-hooks/recommended',
88
],
9-
ignorePatterns: ['dist', '.eslintrc.cjs', 'src/rest/*'],
9+
ignorePatterns: [
10+
'dist',
11+
'.eslintrc.cjs',
12+
'src/rest/*' // do not lint generated code
13+
],
1014
parser: '@typescript-eslint/parser',
1115
plugins: ['react-refresh'],
1216
rules: {
1317
'react-refresh/only-export-components': [
1418
'warn',
1519
{ allowConstantExport: true },
1620
],
17-
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/no-explicit-any': "off", // No strict typing (annoying especially with React elements and events callbacks)
22+
"indent": ["error", 2, { "SwitchCase": 1 }],
23+
"curly": "error", // enforce braces for one-line blocks
24+
"no-tabs": "error", // enforce no tabs
25+
26+
"no-console": ["warn", { allow: ["warn", "error", "debug"] }],
27+
"consistent-return": "warn", // https://eslint.org/docs/latest/rules/consistent-return
28+
"prefer-arrow-callback": ["warn"],
29+
"object-curly-spacing": ["warn", "always"], // enforce consistent spacing inside braces
30+
31+
"func-style": "off", // function expressions or arrow functions are equally valid
32+
33+
"no-unneeded-ternary": "warn", // disallow unnecessary ternary expressions
34+
// React rules: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules
35+
"react/prop-types": "off", // PropTypes are not forced
36+
"react/forbid-prop-types": "off", // all PropTypes are allowed
37+
"react-hooks/rules-of-hooks": "error", // https://react.dev/reference/rules/rules-of-hooks
38+
"react-hooks/exhaustive-deps": "warn", // Hooks dependency array, sometimes it's better to ignore
1839
}
1940
}

0 commit comments

Comments
 (0)