@clipboard-health/eslint-config 4.3.0 → 4.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/index.d.ts +88 -0
- package/src/index.js +152 -175
- package/src/index.js.map +1 -0
- package/src/react.d.ts +6 -0
- package/src/react.js +7 -5
- package/src/react.js.map +1 -0
- package/.eslintrc.json +0 -17
- package/jest.config.ts +0 -19
- package/project.json +0 -33
- package/src/index.spec.ts +0 -188
- package/src/react.spec.ts +0 -13
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -9
- package/tsconfig.lint.json +0 -7
- package/tsconfig.spec.json +0 -7
- package/typedoc.json +0 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/eslint-config",
|
|
3
3
|
"description": "Clipboard Health's ESLint configuration.",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.4",
|
|
5
5
|
"bugs": "https://github.com/clipboardhealth/core-utils/issues",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"config",
|
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
"directory": "packages/nx-plugin"
|
|
40
40
|
},
|
|
41
41
|
"type": "commonjs",
|
|
42
|
-
"typings": "./src/index.d.ts"
|
|
42
|
+
"typings": "./src/index.d.ts",
|
|
43
|
+
"types": "./src/index.d.ts"
|
|
43
44
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
declare let _extends: string[];
|
|
2
|
+
export { _extends as extends };
|
|
3
|
+
export declare let parser: string;
|
|
4
|
+
export declare namespace parserOptions {
|
|
5
|
+
let project: string[];
|
|
6
|
+
let tsconfigRootDir: string;
|
|
7
|
+
}
|
|
8
|
+
export declare let plugins: string[];
|
|
9
|
+
export declare let rules: {
|
|
10
|
+
/**
|
|
11
|
+
* Disable the capitalization of comments
|
|
12
|
+
* It makes code "not build" when just commented temporarily, which we've
|
|
13
|
+
* found to add more friction than the value from having consistent capitalization.
|
|
14
|
+
*/
|
|
15
|
+
"capitalized-comments": string;
|
|
16
|
+
"@typescript-eslint/consistent-type-definitions": string[];
|
|
17
|
+
"@typescript-eslint/naming-convention": string;
|
|
18
|
+
"security/detect-object-injection": string;
|
|
19
|
+
"@typescript-eslint/no-unused-vars": (string | {
|
|
20
|
+
argsIgnorePattern: string;
|
|
21
|
+
})[];
|
|
22
|
+
"no-return-await": string;
|
|
23
|
+
"@typescript-eslint/return-await": string[];
|
|
24
|
+
curly: string[];
|
|
25
|
+
"class-methods-use-this": string;
|
|
26
|
+
"import/extensions": string;
|
|
27
|
+
"n/no-missing-import": string;
|
|
28
|
+
"n/no-unpublished-import": string;
|
|
29
|
+
"unicorn/prefer-module": string;
|
|
30
|
+
"import/no-extraneous-dependencies": string;
|
|
31
|
+
"import/no-unresolved": string;
|
|
32
|
+
"import/prefer-default-export": string;
|
|
33
|
+
"new-cap": (string | {
|
|
34
|
+
newIsCap: boolean;
|
|
35
|
+
capIsNew: boolean;
|
|
36
|
+
})[];
|
|
37
|
+
"import/no-cycle": (string | {
|
|
38
|
+
ignoreExternal: boolean;
|
|
39
|
+
maxDepth: number;
|
|
40
|
+
})[];
|
|
41
|
+
"no-only-tests/no-only-tests": string;
|
|
42
|
+
"no-restricted-syntax": (string | {
|
|
43
|
+
selector: string;
|
|
44
|
+
message: string;
|
|
45
|
+
})[];
|
|
46
|
+
"no-shadow": string;
|
|
47
|
+
"object-shorthand": string[];
|
|
48
|
+
"simple-import-sort/imports": string;
|
|
49
|
+
"simple-import-sort/exports": string;
|
|
50
|
+
"unicorn/no-array-for-each": string;
|
|
51
|
+
"unicorn/no-array-reduce": string;
|
|
52
|
+
"unicorn/prevent-abbreviations": (string | {
|
|
53
|
+
ignore: RegExp[];
|
|
54
|
+
})[];
|
|
55
|
+
"no-underscore-dangle": string;
|
|
56
|
+
"no-restricted-imports": (string | {
|
|
57
|
+
paths: {
|
|
58
|
+
name: string;
|
|
59
|
+
importNames: string[];
|
|
60
|
+
message: string;
|
|
61
|
+
}[];
|
|
62
|
+
})[];
|
|
63
|
+
};
|
|
64
|
+
export declare let overrides: ({
|
|
65
|
+
files: string[];
|
|
66
|
+
rules: {
|
|
67
|
+
"@typescript-eslint/no-unsafe-assignment": string;
|
|
68
|
+
"sonarjs/no-duplicate-string": string;
|
|
69
|
+
"@typescript-eslint/ban-types"?: never;
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
files: string[];
|
|
73
|
+
rules: {
|
|
74
|
+
"@typescript-eslint/ban-types": (string | {
|
|
75
|
+
extendDefaults: boolean;
|
|
76
|
+
types: {
|
|
77
|
+
null: boolean;
|
|
78
|
+
};
|
|
79
|
+
})[];
|
|
80
|
+
"@typescript-eslint/no-unsafe-assignment"?: never;
|
|
81
|
+
"sonarjs/no-duplicate-string"?: never;
|
|
82
|
+
};
|
|
83
|
+
})[];
|
|
84
|
+
export declare namespace settings {
|
|
85
|
+
namespace node {
|
|
86
|
+
let version: string;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,182 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
parser: "@typescript-eslint/parser",
|
|
21
|
-
parserOptions: {
|
|
22
|
-
project: ["tsconfig.json"],
|
|
23
|
-
tsconfigRootDir: __dirname,
|
|
24
|
-
},
|
|
25
|
-
plugins: ["jest", "no-only-tests", "simple-import-sort", "sonarjs", "@typescript-eslint"],
|
|
26
|
-
rules: {
|
|
27
|
-
/**
|
|
28
|
-
* Disable the capitalization of comments
|
|
29
|
-
* It makes code "not build" when just commented temporarily, which we've
|
|
30
|
-
* found to add more friction than the value from having consistent capitalization.
|
|
31
|
-
*/
|
|
32
|
-
"capitalized-comments": "off",
|
|
33
|
-
|
|
34
|
-
// See https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections
|
|
35
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
36
|
-
|
|
37
|
-
// Too many false positives
|
|
38
|
-
"@typescript-eslint/naming-convention": "off",
|
|
39
|
-
"security/detect-object-injection": "off",
|
|
40
|
-
|
|
41
|
-
// Prefer an escape hatch instead of an outright ban
|
|
42
|
-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
43
|
-
|
|
44
|
-
// Prefer debugging ease over an extra microtask by requiring `return await`.
|
|
45
|
-
// `no-return-await` states "This can make debugging more difficult."
|
|
46
|
-
"no-return-await": "off",
|
|
47
|
-
"@typescript-eslint/return-await": ["error", "always"],
|
|
48
|
-
|
|
49
|
-
// Prevent bugs
|
|
50
|
-
curly: ["error", "all"],
|
|
51
|
-
|
|
52
|
-
// Recommends using static fields instead of moving to a function
|
|
53
|
-
"class-methods-use-this": "off",
|
|
54
|
-
|
|
55
|
-
// Our libraries don't use ESM
|
|
56
|
-
"import/extensions": "off",
|
|
57
|
-
"n/no-missing-import": "off",
|
|
58
|
-
"n/no-unpublished-import": "off",
|
|
59
|
-
"unicorn/prefer-module": "off",
|
|
60
|
-
|
|
61
|
-
// Rely on `"n/no-extraneous-import"` instead
|
|
62
|
-
"import/no-extraneous-dependencies": "off",
|
|
63
|
-
|
|
64
|
-
// Doesn't play well with NX/monorepos
|
|
65
|
-
"import/no-unresolved": "off",
|
|
66
|
-
|
|
67
|
-
// Prefer named exports
|
|
68
|
-
"import/prefer-default-export": "off",
|
|
69
|
-
|
|
70
|
-
// Allow PascalCase for Decorators
|
|
71
|
-
"new-cap": ["warn", { newIsCap: true, capIsNew: false }],
|
|
72
|
-
|
|
73
|
-
"import/no-cycle": ["error", { ignoreExternal: true, maxDepth: 16 }],
|
|
74
|
-
/*
|
|
75
|
-
* Don't allow `.only` in tests to prevent it from making it
|
|
76
|
-
* into `main` and circumventing our tests.
|
|
77
|
-
*/
|
|
78
|
-
"no-only-tests/no-only-tests": "error",
|
|
79
|
-
|
|
80
|
-
// Adapter from Airbnb's config, but allows ForOfStatement.
|
|
81
|
-
// See https://github.com/airbnb/javascript/blob/0f3ca32323b8d5770de3301036e65511c6d18e00/packages/eslint-config-airbnb-base/rules/style.js#L340-L358
|
|
82
|
-
"no-restricted-syntax": [
|
|
83
|
-
"error",
|
|
84
|
-
{
|
|
85
|
-
selector: "ForInStatement",
|
|
86
|
-
message:
|
|
87
|
-
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
selector: "LabeledStatement",
|
|
91
|
-
message:
|
|
92
|
-
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
selector: "WithStatement",
|
|
96
|
-
message:
|
|
97
|
-
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
98
|
-
},
|
|
3
|
+
extends: [
|
|
4
|
+
"eslint:recommended",
|
|
5
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
6
|
+
"plugin:@typescript-eslint/recommended",
|
|
7
|
+
"airbnb-base",
|
|
8
|
+
"plugin:eslint-comments/recommended",
|
|
9
|
+
"plugin:jest/recommended",
|
|
10
|
+
"plugin:jest/style",
|
|
11
|
+
"plugin:import/recommended",
|
|
12
|
+
"plugin:n/recommended",
|
|
13
|
+
"plugin:no-use-extend-native/recommended",
|
|
14
|
+
"plugin:security/recommended",
|
|
15
|
+
"plugin:sonarjs/recommended",
|
|
16
|
+
"plugin:unicorn/recommended",
|
|
17
|
+
"xo",
|
|
18
|
+
"xo-typescript/space",
|
|
19
|
+
"prettier",
|
|
99
20
|
],
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/*
|
|
105
|
-
* Only enable for properties. Favor arrow functions, they don’t have a `this` reference,
|
|
106
|
-
* preventing accidental usage.
|
|
107
|
-
*/
|
|
108
|
-
"object-shorthand": ["error", "properties"],
|
|
109
|
-
|
|
110
|
-
// Sort imports and exports
|
|
111
|
-
"simple-import-sort/imports": "warn",
|
|
112
|
-
"simple-import-sort/exports": "warn",
|
|
113
|
-
|
|
114
|
-
// "Better readability" is subjective
|
|
115
|
-
"unicorn/no-array-for-each": "off",
|
|
116
|
-
"unicorn/no-array-reduce": "off",
|
|
117
|
-
|
|
118
|
-
// Allow common, well understood abbreviations
|
|
119
|
-
"unicorn/prevent-abbreviations": [
|
|
120
|
-
"error",
|
|
121
|
-
{ ignore: [/config/i, /params/i, /props/i, /ref/i] },
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
// Polarizing naming convention that isn't followed by us
|
|
125
|
-
"no-underscore-dangle": "off",
|
|
126
|
-
|
|
127
|
-
"no-restricted-imports": [
|
|
128
|
-
"error",
|
|
129
|
-
{
|
|
130
|
-
paths: [
|
|
131
|
-
// We want `ObjectId` to be imported from `mongoose` only
|
|
132
|
-
{
|
|
133
|
-
name: "mongodb",
|
|
134
|
-
importNames: ["ObjectId", "ObjectID"],
|
|
135
|
-
message:
|
|
136
|
-
'Importing `ObjectId` from `mongodb` is not allowed. Use `import { Types } from "mongoose"` and then `Types.ObjectId` instead.',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
overrides: [
|
|
143
|
-
{
|
|
144
|
-
files: [
|
|
145
|
-
"*.spec.ts",
|
|
146
|
-
"*.spec.tsx",
|
|
147
|
-
"*.spec.js",
|
|
148
|
-
"*.spec.jsx",
|
|
149
|
-
"*.test.ts",
|
|
150
|
-
"*.test.tsx",
|
|
151
|
-
"*.test.js",
|
|
152
|
-
"*.test.jsx",
|
|
153
|
-
],
|
|
154
|
-
rules: {
|
|
155
|
-
// Interferes with `jest`'s `expect.any`
|
|
156
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
157
|
-
|
|
158
|
-
// Duplication allows verbose test case setups and asserts
|
|
159
|
-
"sonarjs/no-duplicate-string": "off",
|
|
160
|
-
},
|
|
21
|
+
parser: "@typescript-eslint/parser",
|
|
22
|
+
parserOptions: {
|
|
23
|
+
project: ["tsconfig.json"],
|
|
24
|
+
tsconfigRootDir: __dirname,
|
|
161
25
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
26
|
+
plugins: ["jest", "no-only-tests", "simple-import-sort", "sonarjs", "@typescript-eslint"],
|
|
27
|
+
rules: {
|
|
28
|
+
/**
|
|
29
|
+
* Disable the capitalization of comments
|
|
30
|
+
* It makes code "not build" when just commented temporarily, which we've
|
|
31
|
+
* found to add more friction than the value from having consistent capitalization.
|
|
32
|
+
*/
|
|
33
|
+
"capitalized-comments": "off",
|
|
34
|
+
// See https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections
|
|
35
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
36
|
+
// Too many false positives
|
|
37
|
+
"@typescript-eslint/naming-convention": "off",
|
|
38
|
+
"security/detect-object-injection": "off",
|
|
39
|
+
// Prefer an escape hatch instead of an outright ban
|
|
40
|
+
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
41
|
+
// Prefer debugging ease over an extra microtask by requiring `return await`.
|
|
42
|
+
// `no-return-await` states "This can make debugging more difficult."
|
|
43
|
+
"no-return-await": "off",
|
|
44
|
+
"@typescript-eslint/return-await": ["error", "always"],
|
|
45
|
+
// Prevent bugs
|
|
46
|
+
curly: ["error", "all"],
|
|
47
|
+
// Recommends using static fields instead of moving to a function
|
|
48
|
+
"class-methods-use-this": "off",
|
|
49
|
+
// Our libraries don't use ESM
|
|
50
|
+
"import/extensions": "off",
|
|
51
|
+
"n/no-missing-import": "off",
|
|
52
|
+
"n/no-unpublished-import": "off",
|
|
53
|
+
"unicorn/prefer-module": "off",
|
|
54
|
+
// Rely on `"n/no-extraneous-import"` instead
|
|
55
|
+
"import/no-extraneous-dependencies": "off",
|
|
56
|
+
// Doesn't play well with NX/monorepos
|
|
57
|
+
"import/no-unresolved": "off",
|
|
58
|
+
// Prefer named exports
|
|
59
|
+
"import/prefer-default-export": "off",
|
|
60
|
+
// Allow PascalCase for Decorators
|
|
61
|
+
"new-cap": ["warn", { newIsCap: true, capIsNew: false }],
|
|
62
|
+
"import/no-cycle": ["error", { ignoreExternal: true, maxDepth: 16 }],
|
|
63
|
+
/*
|
|
64
|
+
* Don't allow `.only` in tests to prevent it from making it
|
|
65
|
+
* into `main` and circumventing our tests.
|
|
66
|
+
*/
|
|
67
|
+
"no-only-tests/no-only-tests": "error",
|
|
68
|
+
// Adapter from Airbnb's config, but allows ForOfStatement.
|
|
69
|
+
// See https://github.com/airbnb/javascript/blob/0f3ca32323b8d5770de3301036e65511c6d18e00/packages/eslint-config-airbnb-base/rules/style.js#L340-L358
|
|
70
|
+
"no-restricted-syntax": [
|
|
71
|
+
"error",
|
|
72
|
+
{
|
|
73
|
+
selector: "ForInStatement",
|
|
74
|
+
message: "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
selector: "LabeledStatement",
|
|
78
|
+
message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
selector: "WithStatement",
|
|
82
|
+
message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
// False positive on `enum`s
|
|
86
|
+
"no-shadow": "off",
|
|
87
|
+
/*
|
|
88
|
+
* Only enable for properties. Favor arrow functions, they don’t have a `this` reference,
|
|
89
|
+
* preventing accidental usage.
|
|
90
|
+
*/
|
|
91
|
+
"object-shorthand": ["error", "properties"],
|
|
92
|
+
// Sort imports and exports
|
|
93
|
+
"simple-import-sort/imports": "warn",
|
|
94
|
+
"simple-import-sort/exports": "warn",
|
|
95
|
+
// "Better readability" is subjective
|
|
96
|
+
"unicorn/no-array-for-each": "off",
|
|
97
|
+
"unicorn/no-array-reduce": "off",
|
|
98
|
+
// Allow common, well understood abbreviations
|
|
99
|
+
"unicorn/prevent-abbreviations": [
|
|
100
|
+
"error",
|
|
101
|
+
{ ignore: [/config/i, /params/i, /props/i, /ref/i] },
|
|
102
|
+
],
|
|
103
|
+
// Polarizing naming convention that isn't followed by us
|
|
104
|
+
"no-underscore-dangle": "off",
|
|
105
|
+
"no-restricted-imports": [
|
|
106
|
+
"error",
|
|
107
|
+
{
|
|
108
|
+
paths: [
|
|
109
|
+
// We want `ObjectId` to be imported from `mongoose` only
|
|
110
|
+
{
|
|
111
|
+
name: "mongodb",
|
|
112
|
+
importNames: ["ObjectId", "ObjectID"],
|
|
113
|
+
message: 'Importing `ObjectId` from `mongodb` is not allowed. Use `import { Types } from "mongoose"` and then `Types.ObjectId` instead.',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
175
116
|
},
|
|
176
|
-
},
|
|
177
117
|
],
|
|
178
|
-
},
|
|
179
118
|
},
|
|
180
|
-
|
|
181
|
-
|
|
119
|
+
overrides: [
|
|
120
|
+
{
|
|
121
|
+
files: [
|
|
122
|
+
"*.spec.ts",
|
|
123
|
+
"*.spec.tsx",
|
|
124
|
+
"*.spec.js",
|
|
125
|
+
"*.spec.jsx",
|
|
126
|
+
"*.test.ts",
|
|
127
|
+
"*.test.tsx",
|
|
128
|
+
"*.test.js",
|
|
129
|
+
"*.test.jsx",
|
|
130
|
+
],
|
|
131
|
+
rules: {
|
|
132
|
+
// Interferes with `jest`'s `expect.any`
|
|
133
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
134
|
+
// Duplication allows verbose test case setups and asserts
|
|
135
|
+
"sonarjs/no-duplicate-string": "off",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Exclude *.dto.ts, null is needed for PATCH endpoints to differentiate empty from optional fields
|
|
140
|
+
* Exclude *.repository.ts, null is needed for our ORMs (prisma and mongoose)
|
|
141
|
+
*/
|
|
142
|
+
{
|
|
143
|
+
files: ["**/*.dto.ts", "**/*.repository.ts"],
|
|
144
|
+
rules: {
|
|
145
|
+
"@typescript-eslint/ban-types": [
|
|
146
|
+
"error",
|
|
147
|
+
{
|
|
148
|
+
extendDefaults: true,
|
|
149
|
+
types: {
|
|
150
|
+
null: false,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
settings: { node: { version: ">=18.15.0" } },
|
|
182
158
|
};
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/eslint-config/src/index.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,OAAO,EAAE;QACP,oBAAoB;QACpB,8CAA8C;QAC9C,uCAAuC;QACvC,aAAa;QACb,oCAAoC;QACpC,yBAAyB;QACzB,mBAAmB;QACnB,2BAA2B;QAC3B,sBAAsB;QACtB,yCAAyC;QACzC,6BAA6B;QAC7B,4BAA4B;QAC5B,4BAA4B;QAC5B,IAAI;QACJ,qBAAqB;QACrB,UAAU;KACX;IACD,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,eAA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I,EAAE,KAAK;yBACZ;qBACF;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;CAC7C,CAAC"}
|
package/src/react.d.ts
ADDED
package/src/react.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
extends: ["./index", "xo-react/space"],
|
|
4
|
+
parserOptions: {
|
|
5
|
+
project: ["tsconfig.json"],
|
|
6
|
+
tsconfigRootDir: __dirname,
|
|
7
|
+
},
|
|
7
8
|
};
|
|
9
|
+
//# sourceMappingURL=react.js.map
|
package/src/react.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../packages/eslint-config/src/react.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,OAAO,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACtC,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,eAAe,CAAC;QAC1B,eAAe,EAAE,SAAS;KAC3B;CACF,CAAC"}
|
package/.eslintrc.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"project": "tsconfig.lint.json",
|
|
6
|
-
"tsconfigRootDir": "packages/eslint-config"
|
|
7
|
-
},
|
|
8
|
-
"overrides": [
|
|
9
|
-
{
|
|
10
|
-
"files": "*.json",
|
|
11
|
-
"parser": "jsonc-eslint-parser",
|
|
12
|
-
"rules": {
|
|
13
|
-
"@nx/dependency-checks": "off"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
package/jest.config.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
coverageDirectory: "../../coverage/packages/eslint-config",
|
|
3
|
-
coveragePathIgnorePatterns: [],
|
|
4
|
-
coverageThreshold: {
|
|
5
|
-
global: {
|
|
6
|
-
branches: 100,
|
|
7
|
-
functions: 100,
|
|
8
|
-
lines: 100,
|
|
9
|
-
statements: 100,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
displayName: "eslint-config",
|
|
13
|
-
moduleFileExtensions: ["ts", "js"],
|
|
14
|
-
preset: "../../jest.preset.js",
|
|
15
|
-
testEnvironment: "node",
|
|
16
|
-
transform: {
|
|
17
|
-
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
|
|
18
|
-
},
|
|
19
|
-
};
|
package/project.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
3
|
-
"name": "eslint-config",
|
|
4
|
-
"projectType": "library",
|
|
5
|
-
"sourceRoot": "packages/eslint-config/src",
|
|
6
|
-
"tags": [],
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/js:tsc",
|
|
10
|
-
"options": {
|
|
11
|
-
"assets": ["packages/eslint-config/*.md"],
|
|
12
|
-
"main": "packages/eslint-config/src/index.js",
|
|
13
|
-
"outputPath": "dist/packages/eslint-config",
|
|
14
|
-
"tsConfig": "packages/eslint-config/tsconfig.lib.json"
|
|
15
|
-
},
|
|
16
|
-
"outputs": ["{options.outputPath}"]
|
|
17
|
-
},
|
|
18
|
-
"lint": {
|
|
19
|
-
"executor": "@nx/eslint:lint",
|
|
20
|
-
"options": {
|
|
21
|
-
"lintFilePatterns": ["packages/eslint-config/**/*.[jt]s"],
|
|
22
|
-
"maxWarnings": 0
|
|
23
|
-
},
|
|
24
|
-
"outputs": ["{options.outputFile}"]
|
|
25
|
-
},
|
|
26
|
-
"test": {
|
|
27
|
-
"executor": "@nx/jest:jest",
|
|
28
|
-
"options": {
|
|
29
|
-
"jestConfig": "packages/eslint-config/jest.config.ts"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/index.spec.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import config from ".";
|
|
2
|
-
|
|
3
|
-
describe("eslint-config", () => {
|
|
4
|
-
it("matches", () => {
|
|
5
|
-
expect(config).toEqual({
|
|
6
|
-
extends: [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
9
|
-
"plugin:@typescript-eslint/recommended",
|
|
10
|
-
"airbnb-base",
|
|
11
|
-
"plugin:eslint-comments/recommended",
|
|
12
|
-
"plugin:jest/recommended",
|
|
13
|
-
"plugin:jest/style",
|
|
14
|
-
"plugin:import/recommended",
|
|
15
|
-
"plugin:n/recommended",
|
|
16
|
-
"plugin:no-use-extend-native/recommended",
|
|
17
|
-
"plugin:security/recommended",
|
|
18
|
-
"plugin:sonarjs/recommended",
|
|
19
|
-
"plugin:unicorn/recommended",
|
|
20
|
-
"xo",
|
|
21
|
-
"xo-typescript/space",
|
|
22
|
-
"prettier",
|
|
23
|
-
],
|
|
24
|
-
parser: "@typescript-eslint/parser",
|
|
25
|
-
parserOptions: {
|
|
26
|
-
project: ["tsconfig.json"],
|
|
27
|
-
tsconfigRootDir: __dirname,
|
|
28
|
-
},
|
|
29
|
-
plugins: ["jest", "no-only-tests", "simple-import-sort", "sonarjs", "@typescript-eslint"],
|
|
30
|
-
rules: {
|
|
31
|
-
/**
|
|
32
|
-
* Disable the capitalization of comments
|
|
33
|
-
* It makes code "not build" when just commented temporarily, which we've
|
|
34
|
-
* found to add more friction than the value from having consistent capitalization.
|
|
35
|
-
*/
|
|
36
|
-
"capitalized-comments": "off",
|
|
37
|
-
|
|
38
|
-
// See https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections
|
|
39
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
40
|
-
|
|
41
|
-
// Too many false positives
|
|
42
|
-
"@typescript-eslint/naming-convention": "off",
|
|
43
|
-
"security/detect-object-injection": "off",
|
|
44
|
-
|
|
45
|
-
// Prefer an escape hatch instead of an outright ban
|
|
46
|
-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
47
|
-
|
|
48
|
-
// Prefer debugging ease over an extra microtask by requiring `return await`.
|
|
49
|
-
// `no-return-await` states "This can make debugging more difficult."
|
|
50
|
-
"no-return-await": "off",
|
|
51
|
-
"@typescript-eslint/return-await": ["error", "always"],
|
|
52
|
-
|
|
53
|
-
// Prevent bugs
|
|
54
|
-
curly: ["error", "all"],
|
|
55
|
-
|
|
56
|
-
// Recommends using static fields instead of moving to a function
|
|
57
|
-
"class-methods-use-this": "off",
|
|
58
|
-
|
|
59
|
-
// Our libraries don't use ESM
|
|
60
|
-
"import/extensions": "off",
|
|
61
|
-
"n/no-missing-import": "off",
|
|
62
|
-
"n/no-unpublished-import": "off",
|
|
63
|
-
"unicorn/prefer-module": "off",
|
|
64
|
-
|
|
65
|
-
// Rely on `"n/no-extraneous-import"` instead
|
|
66
|
-
"import/no-extraneous-dependencies": "off",
|
|
67
|
-
|
|
68
|
-
// Doesn't play well with NX/monorepos
|
|
69
|
-
"import/no-unresolved": "off",
|
|
70
|
-
|
|
71
|
-
// Prefer named exports
|
|
72
|
-
"import/prefer-default-export": "off",
|
|
73
|
-
|
|
74
|
-
// Allow PascalCase for Decorators
|
|
75
|
-
"new-cap": ["warn", { newIsCap: true, capIsNew: false }],
|
|
76
|
-
|
|
77
|
-
"import/no-cycle": ["error", { ignoreExternal: true, maxDepth: 16 }],
|
|
78
|
-
/*
|
|
79
|
-
* Don't allow `.only` in tests to prevent it from making it
|
|
80
|
-
* into `main` and circumventing our tests.
|
|
81
|
-
*/
|
|
82
|
-
"no-only-tests/no-only-tests": "error",
|
|
83
|
-
|
|
84
|
-
// Adapter from Airbnb's config, but allows ForOfStatement.
|
|
85
|
-
// See https://github.com/airbnb/javascript/blob/0f3ca32323b8d5770de3301036e65511c6d18e00/packages/eslint-config-airbnb-base/rules/style.js#L340-L358
|
|
86
|
-
"no-restricted-syntax": [
|
|
87
|
-
"error",
|
|
88
|
-
{
|
|
89
|
-
selector: "ForInStatement",
|
|
90
|
-
message:
|
|
91
|
-
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
selector: "LabeledStatement",
|
|
95
|
-
message:
|
|
96
|
-
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
selector: "WithStatement",
|
|
100
|
-
message:
|
|
101
|
-
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
|
|
105
|
-
// False positive on `enum`s
|
|
106
|
-
"no-shadow": "off",
|
|
107
|
-
|
|
108
|
-
/*
|
|
109
|
-
* Only enable for properties. Favor arrow functions, they don’t have a `this` reference,
|
|
110
|
-
* preventing accidental usage.
|
|
111
|
-
*/
|
|
112
|
-
"object-shorthand": ["error", "properties"],
|
|
113
|
-
|
|
114
|
-
// Sort imports and exports
|
|
115
|
-
"simple-import-sort/imports": "warn",
|
|
116
|
-
"simple-import-sort/exports": "warn",
|
|
117
|
-
|
|
118
|
-
// "Better readability" is subjective
|
|
119
|
-
"unicorn/no-array-for-each": "off",
|
|
120
|
-
"unicorn/no-array-reduce": "off",
|
|
121
|
-
|
|
122
|
-
// Allow common, well understood abbreviations
|
|
123
|
-
"unicorn/prevent-abbreviations": [
|
|
124
|
-
"error",
|
|
125
|
-
{ ignore: [/config/i, /params/i, /props/i, /ref/i] },
|
|
126
|
-
],
|
|
127
|
-
|
|
128
|
-
// Polarizing naming convention that isn't followed by us
|
|
129
|
-
"no-underscore-dangle": "off",
|
|
130
|
-
|
|
131
|
-
"no-restricted-imports": [
|
|
132
|
-
"error",
|
|
133
|
-
{
|
|
134
|
-
paths: [
|
|
135
|
-
// We want `ObjectId` to be imported from `mongoose` only
|
|
136
|
-
{
|
|
137
|
-
name: "mongodb",
|
|
138
|
-
importNames: ["ObjectId", "ObjectID"],
|
|
139
|
-
message:
|
|
140
|
-
'Importing `ObjectId` from `mongodb` is not allowed. Use `import { Types } from "mongoose"` and then `Types.ObjectId` instead.',
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
overrides: [
|
|
147
|
-
{
|
|
148
|
-
files: [
|
|
149
|
-
"*.spec.ts",
|
|
150
|
-
"*.spec.tsx",
|
|
151
|
-
"*.spec.js",
|
|
152
|
-
"*.spec.jsx",
|
|
153
|
-
"*.test.ts",
|
|
154
|
-
"*.test.tsx",
|
|
155
|
-
"*.test.js",
|
|
156
|
-
"*.test.jsx",
|
|
157
|
-
],
|
|
158
|
-
rules: {
|
|
159
|
-
// Interferes with `jest`'s `expect.any`
|
|
160
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
161
|
-
|
|
162
|
-
// Duplication allows verbose test case setups and asserts
|
|
163
|
-
"sonarjs/no-duplicate-string": "off",
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
/**
|
|
167
|
-
* Exclude *.dto.ts, null is needed for PATCH endpoints to differentiate empty from optional fields
|
|
168
|
-
* Exclude *.repository.ts, null is needed for our ORMs (prisma and mongoose)
|
|
169
|
-
*/
|
|
170
|
-
{
|
|
171
|
-
files: ["**/*.dto.ts", "**/*.repository.ts"],
|
|
172
|
-
rules: {
|
|
173
|
-
"@typescript-eslint/ban-types": [
|
|
174
|
-
"error",
|
|
175
|
-
{
|
|
176
|
-
extendDefaults: true,
|
|
177
|
-
types: {
|
|
178
|
-
null: false,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
settings: { node: { version: ">=18.15.0" } },
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
});
|
package/src/react.spec.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import config from "./react";
|
|
2
|
-
|
|
3
|
-
describe("eslint-config", () => {
|
|
4
|
-
it("matches", () => {
|
|
5
|
-
expect(config).toEqual({
|
|
6
|
-
extends: ["./index", "xo-react/space"],
|
|
7
|
-
parserOptions: {
|
|
8
|
-
project: ["tsconfig.json"],
|
|
9
|
-
tsconfigRootDir: __dirname,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"outDir": "../../dist/out-tsc"
|
|
6
|
-
},
|
|
7
|
-
"files": [],
|
|
8
|
-
"include": [],
|
|
9
|
-
"references": [
|
|
10
|
-
{
|
|
11
|
-
"path": "./tsconfig.lib.json"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"path": "./tsconfig.lint.json"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "./tsconfig.spec.json"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
package/tsconfig.lib.json
DELETED
package/tsconfig.lint.json
DELETED
package/tsconfig.spec.json
DELETED
package/typedoc.json
DELETED