aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/.eslintrc.cjs
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-12 19:54:46 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-12 19:54:46 +0200
commitd22c3b0c257f5daf5b401988a35ab9ce981a2341 (patch)
tree0a661c927c37b52197326d1c05e211daf9bd19e5 /subprojects/frontend/.eslintrc.cjs
parentfix(language): rule parsing test (diff)
downloadrefinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.tar.gz
refinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.tar.zst
refinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.zip
refactor(frontend): move from Webpack to Vite
Also overhaulds the building and linting for frontend assets.
Diffstat (limited to 'subprojects/frontend/.eslintrc.cjs')
-rw-r--r--subprojects/frontend/.eslintrc.cjs89
1 files changed, 89 insertions, 0 deletions
diff --git a/subprojects/frontend/.eslintrc.cjs b/subprojects/frontend/.eslintrc.cjs
new file mode 100644
index 00000000..e6be4d65
--- /dev/null
+++ b/subprojects/frontend/.eslintrc.cjs
@@ -0,0 +1,89 @@
1const path = require('node:path');
2
3// Allow the Codium ESLint plugin to find `tsconfig.json` from the repository root.
4const project = [
5 path.join(__dirname, 'tsconfig.json'),
6 path.join(__dirname, 'tsconfig.node.json'),
7];
8
9/** @type {import('eslint').Linter.Config} */
10module.exports = {
11 plugins: ['@typescript-eslint'],
12 extends: [
13 'airbnb',
14 'airbnb-typescript',
15 'airbnb/hooks',
16 'plugin:@typescript-eslint/recommended',
17 'plugin:@typescript-eslint/recommended-requiring-type-checking',
18 'plugin:prettier/recommended',
19 ],
20 parserOptions: {
21 project,
22 sourceType: 'module',
23 },
24 parser: '@typescript-eslint/parser',
25 settings: {
26 'import/parsers': {
27 '@typescript-eslint/parser': ['.ts', '.tsx'],
28 },
29 'import/resolver': {
30 typescript: {
31 alwaysTryTypes: true,
32 project,
33 },
34 },
35 },
36 env: {
37 browser: true,
38 },
39 ignorePatterns: ['build/**/*'],
40 rules: {
41 // In typescript, some class methods implementing an inderface do not use `this`:
42 // https://github.com/typescript-eslint/typescript-eslint/issues/1103
43 'class-methods-use-this': 'off',
44 // Make sure every import can be resolved by `eslint-import-resolver-typescript`.
45 'import/no-unresolved': 'error',
46 // Organize imports automatically.
47 'import/order': [
48 'error',
49 {
50 alphabetize: {
51 order: 'asc',
52 },
53 'newlines-between': 'always',
54 },
55 ],
56 },
57 overrides: [
58 {
59 files: ['types/**/*.d.ts'],
60 rules: {
61 // We don't have control over exports of external modules.
62 'import/prefer-default-export': 'off',
63 },
64 },
65 {
66 files: ['*.cjs'],
67 rules: {
68 // https://github.com/typescript-eslint/typescript-eslint/issues/1724
69 '@typescript-eslint/no-var-requires': 'off',
70 },
71 },
72 {
73 files: ['.eslintrc.cjs', 'prettier.config.cjs', 'vite.config.ts'],
74 env: {
75 browser: false,
76 node: true,
77 },
78 rules: {
79 // Allow devDependencies in configuration files.
80 'import/no-extraneous-dependencies': [
81 'error',
82 { devDependencies: true },
83 ],
84 // Access to the environment in configuration files.
85 'no-process-env': 'off',
86 },
87 },
88 ],
89};