@oriflame/config-eslint 4.3.0 → 5.0.3
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/LICENSE +1 -1
- package/README.md +2 -81
- package/dts/index.d.ts +10 -0
- package/lib/index.js +45 -40
- package/lib/index.js.map +1 -0
- package/package.json +37 -30
- package/src/index.ts +21 -27
- package/CHANGELOG.md +0 -3617
- package/lib/index.d.ts +0 -10
- package/lib/index.d.ts.map +0 -1
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts +0 -4
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts.map +0 -1
- package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.js +0 -32
- package/lib/presets/base.d.ts +0 -4
- package/lib/presets/base.d.ts.map +0 -1
- package/lib/presets/base.js +0 -120
- package/lib/presets/future.d.ts +0 -4
- package/lib/presets/future.d.ts.map +0 -1
- package/lib/presets/future.js +0 -13
- package/lib/presets/nextjs.d.ts +0 -4
- package/lib/presets/nextjs.d.ts.map +0 -1
- package/lib/presets/nextjs.js +0 -13
- package/lib/presets/node.d.ts +0 -4
- package/lib/presets/node.d.ts.map +0 -1
- package/lib/presets/node.js +0 -26
- package/lib/presets/prettier.d.ts +0 -4
- package/lib/presets/prettier.d.ts.map +0 -1
- package/lib/presets/prettier.js +0 -13
- package/lib/presets/typescript.d.ts +0 -4
- package/lib/presets/typescript.d.ts.map +0 -1
- package/lib/presets/typescript.js +0 -40
- package/lib/resolvers/graphql.d.ts +0 -6
- package/lib/resolvers/graphql.d.ts.map +0 -1
- package/lib/resolvers/graphql.js +0 -12
- package/lib/rules/a11y.d.ts +0 -4
- package/lib/rules/a11y.d.ts.map +0 -1
- package/lib/rules/a11y.js +0 -45
- package/lib/rules/eslint-comments.d.ts +0 -4
- package/lib/rules/eslint-comments.d.ts.map +0 -1
- package/lib/rules/eslint-comments.js +0 -14
- package/lib/rules/eslint.d.ts +0 -4
- package/lib/rules/eslint.d.ts.map +0 -1
- package/lib/rules/eslint.js +0 -385
- package/lib/rules/import.d.ts +0 -4
- package/lib/rules/import.d.ts.map +0 -1
- package/lib/rules/import.js +0 -76
- package/lib/rules/jest.d.ts +0 -4
- package/lib/rules/jest.d.ts.map +0 -1
- package/lib/rules/jest.js +0 -59
- package/lib/rules/nextjs.d.ts +0 -4
- package/lib/rules/nextjs.d.ts.map +0 -1
- package/lib/rules/nextjs.js +0 -17
- package/lib/rules/node.d.ts +0 -4
- package/lib/rules/node.d.ts.map +0 -1
- package/lib/rules/node.js +0 -45
- package/lib/rules/prettier.d.ts +0 -4
- package/lib/rules/prettier.d.ts.map +0 -1
- package/lib/rules/prettier.js +0 -6
- package/lib/rules/promise.d.ts +0 -4
- package/lib/rules/promise.d.ts.map +0 -1
- package/lib/rules/promise.js +0 -24
- package/lib/rules/react-hooks.d.ts +0 -4
- package/lib/rules/react-hooks.d.ts.map +0 -1
- package/lib/rules/react-hooks.js +0 -7
- package/lib/rules/react.d.ts +0 -4
- package/lib/rules/react.d.ts.map +0 -1
- package/lib/rules/react.js +0 -143
- package/lib/rules/testing-library.d.ts +0 -4
- package/lib/rules/testing-library.d.ts.map +0 -1
- package/lib/rules/testing-library.js +0 -31
- package/lib/rules/typescript.d.ts +0 -4
- package/lib/rules/typescript.d.ts.map +0 -1
- package/lib/rules/typescript.js +0 -369
- package/lib/rules/unicorn.d.ts +0 -4
- package/lib/rules/unicorn.d.ts.map +0 -1
- package/lib/rules/unicorn.js +0 -105
- package/src/presets/SECRET_CONFIG_DO_NOT_USE_THIS.ts +0 -34
- package/src/presets/base.ts +0 -143
- package/src/presets/future.ts +0 -13
- package/src/presets/nextjs.ts +0 -13
- package/src/presets/node.ts +0 -27
- package/src/presets/prettier.ts +0 -13
- package/src/presets/typescript.ts +0 -45
- package/src/resolvers/graphql.ts +0 -11
- package/src/rules/a11y.ts +0 -47
- package/src/rules/eslint-comments.ts +0 -16
- package/src/rules/eslint.ts +0 -384
- package/src/rules/import.ts +0 -79
- package/src/rules/jest.ts +0 -64
- package/src/rules/nextjs.ts +0 -19
- package/src/rules/node.ts +0 -47
- package/src/rules/prettier.ts +0 -8
- package/src/rules/promise.ts +0 -26
- package/src/rules/react-hooks.ts +0 -9
- package/src/rules/react.ts +0 -145
- package/src/rules/testing-library.ts +0 -33
- package/src/rules/typescript.ts +0 -377
- package/src/rules/unicorn.ts +0 -108
- package/test/index.test.ts +0 -81
- package/test/lint-files/combo.ts +0 -10
- package/test/lint-files/errors/combo.ts +0 -3
- package/test/lint-files/errors/javascript.js +0 -2
- package/test/lint-files/errors/next.js +0 -11
- package/test/lint-files/errors/node.js +0 -3
- package/test/lint-files/errors/prettier.js +0 -5
- package/test/lint-files/errors/test.js +0 -3
- package/test/lint-files/errors/typescript.ts +0 -3
- package/test/lint-files/javascript.js +0 -1
- package/test/lint-files/next.js +0 -5
- package/test/lint-files/node.js +0 -2
- package/test/lint-files/prettier.js +0 -1
- package/test/lint-files/test.js +0 -5
- package/test/lint-files/typescript.ts +0 -20
- package/test/tsconfig.json +0 -19
- package/test/utils/getErrors.ts +0 -16
- package/tools/check-rules/allRules.ts +0 -99
- package/tools/check-rules/index.ts +0 -90
- package/tools/check-rules/tsconfig.json +0 -17
- package/tsconfig.json +0 -22
- package/tsconfig.tsbuildinfo +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,82 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oriflame/config-eslint
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
union with the [Lumos](https://www.npmjs.com/package/@oriflame/lumos) CLI.
|
|
5
|
-
|
|
6
|
-
## Extending config
|
|
7
|
-
|
|
8
|
-
**Update package.json:**
|
|
9
|
-
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"lumos": {
|
|
13
|
-
"eslint": {
|
|
14
|
-
"rules": {
|
|
15
|
-
"react-hooks/exhaustive-deps": "off"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Create file in configs folder:**
|
|
23
|
-
|
|
24
|
-
`configs/eslint.js`
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
module.exports = {
|
|
28
|
-
rules: {
|
|
29
|
-
'react-hooks/exhaustive-deps': 'off',
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Settings
|
|
35
|
-
|
|
36
|
-
### Main settings
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
export interface ESLintOptions {
|
|
40
|
-
future?: boolean;
|
|
41
|
-
node?: boolean;
|
|
42
|
-
typescript?: boolean;
|
|
43
|
-
nextjs?: boolean;
|
|
44
|
-
prettier?: boolean;
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Default values
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
{
|
|
52
|
-
future = false,
|
|
53
|
-
node = false,
|
|
54
|
-
typescript = false,
|
|
55
|
-
nextjs = false,
|
|
56
|
-
prettier = false,
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Settings
|
|
61
|
-
|
|
62
|
-
- future
|
|
63
|
-
- Enables rules for new es features
|
|
64
|
-
- node
|
|
65
|
-
- Enables rules for node js development
|
|
66
|
-
- typescript
|
|
67
|
-
- Enables typescript rules
|
|
68
|
-
- nextjs
|
|
69
|
-
- Enables Next.js rules
|
|
70
|
-
- prettier
|
|
71
|
-
- Enables integration with prettier
|
|
72
|
-
|
|
73
|
-
### CLI Options
|
|
74
|
-
|
|
75
|
-
- `--fix`
|
|
76
|
-
- Try to fix autofixable problems.
|
|
77
|
-
|
|
78
|
-
**Example:**
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
lumos eslint --fix
|
|
82
|
-
```
|
|
3
|
+
Documentation was moved to [Lumos package](https://github.com/Oriflame/lumos/tree/master/packages/lumos)
|
package/dts/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ESLintConfig } from '@beemo/driver-eslint';
|
|
2
|
+
export interface ESLintOptions {
|
|
3
|
+
future?: boolean;
|
|
4
|
+
node?: boolean;
|
|
5
|
+
typescript?: boolean;
|
|
6
|
+
nextjs?: boolean;
|
|
7
|
+
prettier?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function getConfig({ future, node, typescript, nextjs, prettier, }: ESLintOptions): ESLintConfig;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const lumosCommon = require('@oriflame/lumos-common');
|
|
8
|
+
|
|
9
|
+
function getConfig({
|
|
10
|
+
future = false,
|
|
11
|
+
node = false,
|
|
12
|
+
typescript = false,
|
|
13
|
+
nextjs = false,
|
|
14
|
+
prettier = false
|
|
15
|
+
}) {
|
|
16
|
+
const presets = ['oriflame'];
|
|
17
|
+
|
|
18
|
+
if (future) {
|
|
19
|
+
presets.push('oriflame/future');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (node) {
|
|
23
|
+
presets.push('oriflame/node');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typescript) {
|
|
27
|
+
presets.push('oriflame/typescript');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (nextjs) {
|
|
31
|
+
presets.push('oriflame/nextjs');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (prettier) {
|
|
35
|
+
presets.push('oriflame/prettier');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
root: true,
|
|
40
|
+
extends: presets,
|
|
41
|
+
ignore: [...lumosCommon.IGNORE_PATHS, 'jest.config.js', 'babel.config.js', 'webpack.config.js', 'build*/', '\\.eslintrc.js']
|
|
42
|
+
};
|
|
10
43
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
paths.push(fromHere('./presets/future'));
|
|
15
|
-
}
|
|
16
|
-
if (node) {
|
|
17
|
-
paths.push(fromHere('./presets/node'));
|
|
18
|
-
}
|
|
19
|
-
if (typescript) {
|
|
20
|
-
paths.push(fromHere('./presets/typescript'));
|
|
21
|
-
}
|
|
22
|
-
if (nextjs) {
|
|
23
|
-
paths.push(fromHere('./presets/nextjs'));
|
|
24
|
-
}
|
|
25
|
-
if (prettier) {
|
|
26
|
-
paths.push(fromHere('./presets/prettier'));
|
|
27
|
-
}
|
|
28
|
-
return paths;
|
|
29
|
-
}
|
|
30
|
-
exports.getExtendsList = getExtendsList;
|
|
31
|
-
function getIgnoreList() {
|
|
32
|
-
return [
|
|
33
|
-
...lumos_common_1.IGNORE_PATHS,
|
|
34
|
-
'jest.config.js',
|
|
35
|
-
'babel.config.js',
|
|
36
|
-
'webpack.config.js',
|
|
37
|
-
'build*/',
|
|
38
|
-
'\\.eslintrc.js',
|
|
39
|
-
];
|
|
40
|
-
}
|
|
41
|
-
exports.getIgnoreList = getIgnoreList;
|
|
44
|
+
|
|
45
|
+
exports.getConfig = getConfig;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":null,"names":["getConfig","future","node","typescript","nextjs","prettier","presets","push","root","extends","ignore","IGNORE_PATHS"],"mappings":";;;;;;AAWO,SAASA,SAAT,CAAmB;AACxBC,EAAAA,MAAM,GAAG,KADe;AAExBC,EAAAA,IAAI,GAAG,KAFiB;AAGxBC,EAAAA,UAAU,GAAG,KAHW;AAIxBC,EAAAA,MAAM,GAAG,KAJe;AAKxBC,EAAAA,QAAQ,GAAG;AALa,CAAnB,EAMyB;AAC9B,QAAMC,OAAO,GAAG,CAAC,UAAD,CAAhB;;AAEA,MAAIL,MAAJ,EAAY;AACVK,IAAAA,OAAO,CAACC,IAAR,CAAa,iBAAb;AACD;;AAED,MAAIL,IAAJ,EAAU;AACRI,IAAAA,OAAO,CAACC,IAAR,CAAa,eAAb;AACD;;AAED,MAAIJ,UAAJ,EAAgB;AACdG,IAAAA,OAAO,CAACC,IAAR,CAAa,qBAAb;AACD;;AAED,MAAIH,MAAJ,EAAY;AACVE,IAAAA,OAAO,CAACC,IAAR,CAAa,iBAAb;AACD;;AAED,MAAIF,QAAJ,EAAc;AACZC,IAAAA,OAAO,CAACC,IAAR,CAAa,mBAAb;AACD;;AAED,SAAO;AACLC,IAAAA,IAAI,EAAE,IADD;AAELC,IAAAA,OAAO,EAAEH,OAFJ;AAGLI,IAAAA,MAAM,EAAE,CACN,GAAGC,wBADG,EAEN,gBAFM,EAGN,iBAHM,EAIN,mBAJM,EAKN,SALM,EAMN,gBANM;AAHH,GAAP;AAYD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oriflame/config-eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Reusable ESLint config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lumos",
|
|
7
7
|
"config",
|
|
8
8
|
"eslint"
|
|
9
9
|
],
|
|
10
|
-
"main": "lib/index.js",
|
|
10
|
+
"main": "./lib/index.js",
|
|
11
|
+
"types": "./dts/index.d.ts",
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
14
|
"url": "git@github.com:Oriflame/lumos.git"
|
|
@@ -17,39 +18,45 @@
|
|
|
17
18
|
"publishConfig": {
|
|
18
19
|
"access": "public"
|
|
19
20
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"check-rules": "ts-node tools/check-rules/index.ts"
|
|
22
|
-
},
|
|
23
21
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
22
|
+
"node": ">=12.17.0",
|
|
23
|
+
"npm": ">=6.13.0"
|
|
25
24
|
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dts/**/*.d.ts",
|
|
27
|
+
"lib/**/*.{js,map,d.ts}",
|
|
28
|
+
"lib/**/*.{js,map}",
|
|
29
|
+
"src/**/*.{ts,tsx,json}"
|
|
30
|
+
],
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"@next/eslint-plugin-next": "^12.0.2",
|
|
30
|
-
"@oriflame/lumos-common": "^4.3.0",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
|
32
|
-
"@typescript-eslint/parser": "^5.2.0",
|
|
33
|
-
"babel-eslint": "^10.1.0",
|
|
34
|
-
"confusing-browser-globals": "^1.0.10",
|
|
35
|
-
"eslint": "^7.32.0",
|
|
36
|
-
"eslint-config-prettier": "^8.3.0",
|
|
37
|
-
"eslint-import-resolver-typescript": "^2.5.0",
|
|
38
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
39
|
-
"eslint-plugin-import": "^2.25.2",
|
|
40
|
-
"eslint-plugin-jest": "^25.2.2",
|
|
41
|
-
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
42
|
-
"eslint-plugin-node": "^11.1.0",
|
|
43
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
44
|
-
"eslint-plugin-promise": "^5.1.1",
|
|
45
|
-
"eslint-plugin-react": "^7.26.1",
|
|
46
|
-
"eslint-plugin-react-hooks": "^4.2.0",
|
|
47
|
-
"eslint-plugin-testing-library": "^5.0.0",
|
|
48
|
-
"eslint-plugin-unicorn": "^37.0.1"
|
|
32
|
+
"@oriflame/lumos-common": "^5.0.3",
|
|
33
|
+
"eslint-config-oriflame": "^5.0.3"
|
|
49
34
|
},
|
|
50
35
|
"devDependencies": {
|
|
51
|
-
"@
|
|
36
|
+
"@beemo/core": "^2.1.3",
|
|
37
|
+
"@beemo/driver-eslint": "^2.0.4",
|
|
38
|
+
"@types/node": "^16.11.14",
|
|
39
|
+
"eslint": "^8.5.0",
|
|
52
40
|
"ts-node": "^10.4.0"
|
|
53
41
|
},
|
|
54
|
-
"
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@beemo/core": "^2.1.2",
|
|
44
|
+
"@beemo/driver-eslint": "^2.0.3",
|
|
45
|
+
"eslint": "^8.4.1",
|
|
46
|
+
"prettier": "^2.5.1",
|
|
47
|
+
"typescript": ">=4.5"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"prettier": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"typescript": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"packemon": {
|
|
58
|
+
"format": "lib",
|
|
59
|
+
"platform": "node"
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "6df4ab463f076eb30e6a138278530e5da464f2bb"
|
|
55
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ESLintConfig } from '@beemo/driver-eslint';
|
|
2
2
|
import { IGNORE_PATHS } from '@oriflame/lumos-common';
|
|
3
3
|
|
|
4
4
|
export interface ESLintOptions {
|
|
@@ -9,51 +9,45 @@ export interface ESLintOptions {
|
|
|
9
9
|
prettier?: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
return `./${new Path(process.cwd())
|
|
14
|
-
.relativeTo(new Path(__dirname, '../lib', filePath).resolve())
|
|
15
|
-
.toString()}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function getExtendsList({
|
|
12
|
+
export function getConfig({
|
|
19
13
|
future = false,
|
|
20
14
|
node = false,
|
|
21
15
|
typescript = false,
|
|
22
16
|
nextjs = false,
|
|
23
17
|
prettier = false,
|
|
24
|
-
}: ESLintOptions):
|
|
25
|
-
const
|
|
18
|
+
}: ESLintOptions): ESLintConfig {
|
|
19
|
+
const presets = ['oriflame'];
|
|
26
20
|
|
|
27
21
|
if (future) {
|
|
28
|
-
|
|
22
|
+
presets.push('oriflame/future');
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
if (node) {
|
|
32
|
-
|
|
26
|
+
presets.push('oriflame/node');
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
if (typescript) {
|
|
36
|
-
|
|
30
|
+
presets.push('oriflame/typescript');
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
if (nextjs) {
|
|
40
|
-
|
|
34
|
+
presets.push('oriflame/nextjs');
|
|
41
35
|
}
|
|
42
36
|
|
|
43
37
|
if (prettier) {
|
|
44
|
-
|
|
38
|
+
presets.push('oriflame/prettier');
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
return {
|
|
42
|
+
root: true,
|
|
43
|
+
extends: presets,
|
|
44
|
+
ignore: [
|
|
45
|
+
...IGNORE_PATHS,
|
|
46
|
+
'jest.config.js',
|
|
47
|
+
'babel.config.js',
|
|
48
|
+
'webpack.config.js',
|
|
49
|
+
'build*/',
|
|
50
|
+
'\\.eslintrc.js',
|
|
51
|
+
],
|
|
52
|
+
};
|
|
59
53
|
}
|