aboutsummaryrefslogtreecommitdiffstats
path: root/.eslintrc.cjs
diff options
context:
space:
mode:
Diffstat (limited to '.eslintrc.cjs')
-rw-r--r--.eslintrc.cjs126
1 files changed, 126 insertions, 0 deletions
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 0000000..92af738
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1,126 @@
1const project = [
2 './tsconfig.json',
3 './packages/*/tsconfig.json',
4];
5
6module.exports = {
7 root: true,
8 plugins: [
9 '@typescript-eslint',
10 ],
11 extends: [
12 'airbnb-base',
13 'airbnb-typescript/base',
14 'plugin:@typescript-eslint/recommended',
15 'plugin:@typescript-eslint/recommended-requiring-type-checking',
16 ],
17 env: {
18 es6: true,
19 node: true,
20 browser: false,
21 jest: true,
22 },
23 parser: '@typescript-eslint/parser',
24 parserOptions: {
25 sourceType: 'module',
26 project,
27 allowAutomaticSingleRunInference: true,
28 tsconfigRootDir: __dirname,
29 warnOnUnsupportedTypeScriptVersion: false,
30 },
31 settings: {
32 'import/parsers': {
33 '@typescript-eslint/parser': ['.ts', '.tsx'],
34 },
35 'import/resolver': {
36 typescript: {
37 alwaysTryTypes: true,
38 project,
39 },
40 },
41 },
42 rules: {
43 'import/no-unresolved': 'error',
44 'import/order': [
45 'error',
46 {
47 alphabetize: {
48 order: 'asc',
49 },
50 'newlines-between': 'always',
51 },
52 ],
53 },
54 overrides: [
55 {
56 files: [
57 '**/stores/**/*.ts',
58 ],
59 rules: {
60 // In a mobx-state-tree action, we assign to the properties of `self` to update the store.
61 'no-param-reassign': 'off',
62 // mobx-state-tree uses empty interfaces to speed up typechecking.
63 '@typescript-eslint/no-empty-interface': 'off',
64 },
65 },
66 {
67 files: [
68 '**/__tests__/*.{ts,tsx}',
69 '**/*.{spec,test}.{ts,tsx}',
70 ],
71 rules: {
72 // If a non-null assertion fails in a test, the test will also fail anyways.
73 '@typescript-eslint/no-non-null-assertion': 'off',
74 // Jest mocks use unbound method references.
75 '@typescript-eslint/unbound-method': 'off',
76 },
77 },
78 {
79 files: [
80 '**/*.js',
81 ],
82 rules: {
83 // ESM requires extensions for imports.
84 'import/extensions': [
85 'error',
86 'ignorePackages',
87 ],
88 },
89 },
90 {
91 files: [
92 '.electron-builder.config.cjs',
93 'config/**/*.{cjs,js}',
94 'jest.config.js',
95 'scripts/**/*.js',
96 'packages/*/*.config.js',
97 ],
98 env: {
99 // Config files are never run in a browser (even in frontend projects).
100 browser: false,
101 node: true,
102 jest: false,
103 },
104 rules: {
105 // Config files and build scripts are allowed to use devDependencies.
106 'import/no-extraneous-dependencies': [
107 'error',
108 {
109 devDependencies: true,
110 },
111 ],
112 // Allow reporting progress to the console from scripts.
113 'no-console': 'off',
114 },
115 },
116 {
117 files: [
118 'packages/*/*.config.js',
119 ],
120 rules: {
121 // Allow relative imports of config files from the root package.
122 'import/no-relative-packages': 'off',
123 },
124 },
125 ],
126};