diff options
author | 2024-04-07 01:59:09 +0200 | |
---|---|---|
committer | 2024-04-07 01:59:09 +0200 | |
commit | 1d2b5c85a177b4be0cc270b8e6e54488e23da5a1 (patch) | |
tree | c8b87c875faa7e6048e5ba41b5a9e4449263fc6a /subprojects/frontend/.eslintrc.cjs | |
parent | chore(deps): upgrade to frontend-jdk17 8.0.0 (diff) | |
download | refinery-1d2b5c85a177b4be0cc270b8e6e54488e23da5a1.tar.gz refinery-1d2b5c85a177b4be0cc270b8e6e54488e23da5a1.tar.zst refinery-1d2b5c85a177b4be0cc270b8e6e54488e23da5a1.zip |
build: move Javascript config to top level
We need this to support multiple Javascript subprojects (e.g., a frontend and a
documentation website).
Diffstat (limited to 'subprojects/frontend/.eslintrc.cjs')
-rw-r--r-- | subprojects/frontend/.eslintrc.cjs | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/subprojects/frontend/.eslintrc.cjs b/subprojects/frontend/.eslintrc.cjs deleted file mode 100644 index 25b86a83..00000000 --- a/subprojects/frontend/.eslintrc.cjs +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | const path = require('node:path'); | ||
8 | |||
9 | // Allow the Codium ESLint plugin to find `tsconfig.json` from the repository root. | ||
10 | const project = [ | ||
11 | path.join(__dirname, 'tsconfig.json'), | ||
12 | path.join(__dirname, 'tsconfig.node.json'), | ||
13 | path.join(__dirname, 'tsconfig.shared.json'), | ||
14 | ]; | ||
15 | |||
16 | /** @type {import('eslint').Linter.Config} */ | ||
17 | module.exports = { | ||
18 | plugins: ['@typescript-eslint', 'mobx'], | ||
19 | extends: [ | ||
20 | 'airbnb', | ||
21 | 'airbnb-typescript', | ||
22 | 'airbnb/hooks', | ||
23 | 'plugin:@typescript-eslint/recommended', | ||
24 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
25 | 'plugin:mobx/recommended', | ||
26 | 'plugin:prettier/recommended', | ||
27 | ], | ||
28 | parserOptions: { | ||
29 | project, | ||
30 | sourceType: 'module', | ||
31 | }, | ||
32 | parser: '@typescript-eslint/parser', | ||
33 | settings: { | ||
34 | 'import/parsers': { | ||
35 | '@typescript-eslint/parser': ['.ts', '.tsx'], | ||
36 | }, | ||
37 | 'import/resolver': { | ||
38 | typescript: { | ||
39 | alwaysTryTypes: true, | ||
40 | project, | ||
41 | }, | ||
42 | }, | ||
43 | }, | ||
44 | env: { | ||
45 | browser: true, | ||
46 | }, | ||
47 | ignorePatterns: ['build/**/*', 'dev-dist/**/*', 'src/**/*.typegen.ts'], | ||
48 | rules: { | ||
49 | // In typescript, some class methods implementing an inderface do not use `this`: | ||
50 | // https://github.com/typescript-eslint/typescript-eslint/issues/1103 | ||
51 | 'class-methods-use-this': 'off', | ||
52 | // Disable rules with a high performance cost. | ||
53 | // See https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting/ | ||
54 | 'import/default': 'off', | ||
55 | 'import/extensions': 'off', | ||
56 | 'import/named': 'off', | ||
57 | 'import/namespace': 'off', | ||
58 | 'import/no-named-as-default': 'off', | ||
59 | 'import/no-named-as-default-member': 'off', | ||
60 | '@typescript-eslint/indent': 'off', | ||
61 | // Make sure every import can be resolved by `eslint-import-resolver-typescript`. | ||
62 | 'import/no-unresolved': 'error', | ||
63 | // Organize imports automatically. | ||
64 | 'import/order': [ | ||
65 | 'error', | ||
66 | { | ||
67 | alphabetize: { | ||
68 | order: 'asc', | ||
69 | }, | ||
70 | 'newlines-between': 'always', | ||
71 | }, | ||
72 | ], | ||
73 | // Not all components depend on observable state. | ||
74 | 'mobx/missing-observer': 'off', | ||
75 | // A dangling underscore, while not neccessary for all private fields, | ||
76 | // is useful for backing fields of properties that should be read-only from outside the class. | ||
77 | 'no-underscore-dangle': [ | ||
78 | 'error', | ||
79 | { | ||
80 | allowAfterThis: true, | ||
81 | allowFunctionParams: true, | ||
82 | }, | ||
83 | ], | ||
84 | // Use prop spreading to conditionally add props with `exactOptionalPropertyTypes`. | ||
85 | 'react/jsx-props-no-spreading': 'off', | ||
86 | // We use the `react-jsx` runtime, so there is no need to import `React`. | ||
87 | 'react/react-in-jsx-scope': 'off', | ||
88 | }, | ||
89 | overrides: [ | ||
90 | { | ||
91 | files: ['types/**/*.d.ts'], | ||
92 | rules: { | ||
93 | // We don't have control over exports of external modules. | ||
94 | 'import/prefer-default-export': 'off', | ||
95 | }, | ||
96 | }, | ||
97 | { | ||
98 | files: ['*.cjs'], | ||
99 | rules: { | ||
100 | // https://github.com/typescript-eslint/typescript-eslint/issues/1724 | ||
101 | '@typescript-eslint/no-var-requires': 'off', | ||
102 | }, | ||
103 | }, | ||
104 | { | ||
105 | files: [ | ||
106 | '.eslintrc.cjs', | ||
107 | 'config/*.ts', | ||
108 | 'config/*.cjs', | ||
109 | 'prettier.config.cjs', | ||
110 | 'vite.config.ts', | ||
111 | ], | ||
112 | env: { | ||
113 | browser: false, | ||
114 | node: true, | ||
115 | }, | ||
116 | rules: { | ||
117 | // Allow devDependencies in configuration files. | ||
118 | 'import/no-extraneous-dependencies': [ | ||
119 | 'error', | ||
120 | { devDependencies: true }, | ||
121 | ], | ||
122 | // Allow writing to the console in ad-hoc scripts. | ||
123 | 'no-console': 'off', | ||
124 | // Access to the environment in configuration files. | ||
125 | 'no-process-env': 'off', | ||
126 | }, | ||
127 | }, | ||
128 | ], | ||
129 | }; | ||