-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
113 lines (112 loc) · 2.86 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const OFF = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
plugins: ["monorepo"],
extends: [
"eslint:recommended",
// "plugin:monorepo/recommended", // FIXME
],
parser: "@babel/eslint-parser",
parserOptions: {
ecmaFeatures: {
legacyDecorators: true,
},
sourceType: "module",
},
overrides: [
{
files: ["packages/**/*.+(ts|tsx)"],
plugins: [
"@typescript-eslint",
"react",
"react-hooks",
"eslint-plugin-jui",
/*"jsdoc"*/
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
legacyDecorators: true,
},
useJSXTextNode: true,
project: "./tsconfig.json",
sourceType: "module",
},
extends: [
"plugin:eslint-plugin-jui/recommended",
// "plugin:@typescript-eslint/recommended",
// "plugin:react-hooks/recommended",
// "plugin:react/recommended",
], // FIXME enable recommended rulesets and remove custom fixes if possible
rules: {
// "no-redeclare": OFF,
// "@typescript-eslint/no-redeclare": ERROR,
"no-unused-vars": OFF,
"no-empty-pattern": OFF,
"no-dupe-class-members": OFF, // no need in ts. TSC handles it, and it doesn't work nice with method overloads
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": ["warn"],
},
},
{
files: [
"packages/jui/scripts/**",
"babel.config.js",
".eslintrc.js",
"**/webpack.config.ts",
],
env: {
node: true,
},
},
{
// Only source files
files: ["packages/jui/src/**"],
excludedFiles: [
"packages/**/*.+(stories|test|spec|cy).tsx",
"packages/jui/src/**/story-helpers.tsx",
"**/cypress/**",
],
rules: {
"no-restricted-imports": [
ERROR,
// No direct import from entry point, as it creates circular dependency. inter-module imports should be from
// "@intellij-platform/core/*" instead, within each module (top level dir), imports should be relative.
{ paths: ["@intellij-platform/core"] },
],
},
},
{
// Only jest test files
files: ["packages/**/*.spec.+(ts|tsx)", "packages/**/*.test.+(ts|tsx)"],
plugins: ["jest", "no-only-tests"],
env: {
jest: true,
},
rules: {
"no-only-tests/no-only-tests": ERROR,
},
},
{
// Only cypress test files
files: ["packages/**/*.cy.+(ts|tsx)", "**/cypress/**"],
plugins: ["cypress", "no-only-tests"],
env: {
"cypress/globals": true,
node: true,
},
rules: {
"no-only-tests/no-only-tests": ERROR,
},
},
],
env: {
browser: true,
es6: true,
},
globals: {
JSX: "readonly",
},
};