@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.
Files changed (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -81
  3. package/dts/index.d.ts +10 -0
  4. package/lib/index.js +45 -40
  5. package/lib/index.js.map +1 -0
  6. package/package.json +37 -30
  7. package/src/index.ts +21 -27
  8. package/CHANGELOG.md +0 -3617
  9. package/lib/index.d.ts +0 -10
  10. package/lib/index.d.ts.map +0 -1
  11. package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts +0 -4
  12. package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.d.ts.map +0 -1
  13. package/lib/presets/SECRET_CONFIG_DO_NOT_USE_THIS.js +0 -32
  14. package/lib/presets/base.d.ts +0 -4
  15. package/lib/presets/base.d.ts.map +0 -1
  16. package/lib/presets/base.js +0 -120
  17. package/lib/presets/future.d.ts +0 -4
  18. package/lib/presets/future.d.ts.map +0 -1
  19. package/lib/presets/future.js +0 -13
  20. package/lib/presets/nextjs.d.ts +0 -4
  21. package/lib/presets/nextjs.d.ts.map +0 -1
  22. package/lib/presets/nextjs.js +0 -13
  23. package/lib/presets/node.d.ts +0 -4
  24. package/lib/presets/node.d.ts.map +0 -1
  25. package/lib/presets/node.js +0 -26
  26. package/lib/presets/prettier.d.ts +0 -4
  27. package/lib/presets/prettier.d.ts.map +0 -1
  28. package/lib/presets/prettier.js +0 -13
  29. package/lib/presets/typescript.d.ts +0 -4
  30. package/lib/presets/typescript.d.ts.map +0 -1
  31. package/lib/presets/typescript.js +0 -40
  32. package/lib/resolvers/graphql.d.ts +0 -6
  33. package/lib/resolvers/graphql.d.ts.map +0 -1
  34. package/lib/resolvers/graphql.js +0 -12
  35. package/lib/rules/a11y.d.ts +0 -4
  36. package/lib/rules/a11y.d.ts.map +0 -1
  37. package/lib/rules/a11y.js +0 -45
  38. package/lib/rules/eslint-comments.d.ts +0 -4
  39. package/lib/rules/eslint-comments.d.ts.map +0 -1
  40. package/lib/rules/eslint-comments.js +0 -14
  41. package/lib/rules/eslint.d.ts +0 -4
  42. package/lib/rules/eslint.d.ts.map +0 -1
  43. package/lib/rules/eslint.js +0 -385
  44. package/lib/rules/import.d.ts +0 -4
  45. package/lib/rules/import.d.ts.map +0 -1
  46. package/lib/rules/import.js +0 -76
  47. package/lib/rules/jest.d.ts +0 -4
  48. package/lib/rules/jest.d.ts.map +0 -1
  49. package/lib/rules/jest.js +0 -59
  50. package/lib/rules/nextjs.d.ts +0 -4
  51. package/lib/rules/nextjs.d.ts.map +0 -1
  52. package/lib/rules/nextjs.js +0 -17
  53. package/lib/rules/node.d.ts +0 -4
  54. package/lib/rules/node.d.ts.map +0 -1
  55. package/lib/rules/node.js +0 -45
  56. package/lib/rules/prettier.d.ts +0 -4
  57. package/lib/rules/prettier.d.ts.map +0 -1
  58. package/lib/rules/prettier.js +0 -6
  59. package/lib/rules/promise.d.ts +0 -4
  60. package/lib/rules/promise.d.ts.map +0 -1
  61. package/lib/rules/promise.js +0 -24
  62. package/lib/rules/react-hooks.d.ts +0 -4
  63. package/lib/rules/react-hooks.d.ts.map +0 -1
  64. package/lib/rules/react-hooks.js +0 -7
  65. package/lib/rules/react.d.ts +0 -4
  66. package/lib/rules/react.d.ts.map +0 -1
  67. package/lib/rules/react.js +0 -143
  68. package/lib/rules/testing-library.d.ts +0 -4
  69. package/lib/rules/testing-library.d.ts.map +0 -1
  70. package/lib/rules/testing-library.js +0 -31
  71. package/lib/rules/typescript.d.ts +0 -4
  72. package/lib/rules/typescript.d.ts.map +0 -1
  73. package/lib/rules/typescript.js +0 -369
  74. package/lib/rules/unicorn.d.ts +0 -4
  75. package/lib/rules/unicorn.d.ts.map +0 -1
  76. package/lib/rules/unicorn.js +0 -105
  77. package/src/presets/SECRET_CONFIG_DO_NOT_USE_THIS.ts +0 -34
  78. package/src/presets/base.ts +0 -143
  79. package/src/presets/future.ts +0 -13
  80. package/src/presets/nextjs.ts +0 -13
  81. package/src/presets/node.ts +0 -27
  82. package/src/presets/prettier.ts +0 -13
  83. package/src/presets/typescript.ts +0 -45
  84. package/src/resolvers/graphql.ts +0 -11
  85. package/src/rules/a11y.ts +0 -47
  86. package/src/rules/eslint-comments.ts +0 -16
  87. package/src/rules/eslint.ts +0 -384
  88. package/src/rules/import.ts +0 -79
  89. package/src/rules/jest.ts +0 -64
  90. package/src/rules/nextjs.ts +0 -19
  91. package/src/rules/node.ts +0 -47
  92. package/src/rules/prettier.ts +0 -8
  93. package/src/rules/promise.ts +0 -26
  94. package/src/rules/react-hooks.ts +0 -9
  95. package/src/rules/react.ts +0 -145
  96. package/src/rules/testing-library.ts +0 -33
  97. package/src/rules/typescript.ts +0 -377
  98. package/src/rules/unicorn.ts +0 -108
  99. package/test/index.test.ts +0 -81
  100. package/test/lint-files/combo.ts +0 -10
  101. package/test/lint-files/errors/combo.ts +0 -3
  102. package/test/lint-files/errors/javascript.js +0 -2
  103. package/test/lint-files/errors/next.js +0 -11
  104. package/test/lint-files/errors/node.js +0 -3
  105. package/test/lint-files/errors/prettier.js +0 -5
  106. package/test/lint-files/errors/test.js +0 -3
  107. package/test/lint-files/errors/typescript.ts +0 -3
  108. package/test/lint-files/javascript.js +0 -1
  109. package/test/lint-files/next.js +0 -5
  110. package/test/lint-files/node.js +0 -2
  111. package/test/lint-files/prettier.js +0 -1
  112. package/test/lint-files/test.js +0 -5
  113. package/test/lint-files/typescript.ts +0 -20
  114. package/test/tsconfig.json +0 -19
  115. package/test/utils/getErrors.ts +0 -16
  116. package/tools/check-rules/allRules.ts +0 -99
  117. package/tools/check-rules/index.ts +0 -90
  118. package/tools/check-rules/tsconfig.json +0 -17
  119. package/tsconfig.json +0 -22
  120. package/tsconfig.tsbuildinfo +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 ORIFLAME SOFTWARE
3
+ Copyright (c) 2021 ORIFLAME SOFTWARE
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,82 +1,3 @@
1
- # ESLint Config
1
+ # @oriflame/config-eslint
2
2
 
3
- Factory functions for creating preset [ESLint](https://eslint.org) configurations. Primarily used in
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIgnoreList = exports.getExtendsList = void 0;
4
- const core_1 = require("@beemo/core");
5
- const lumos_common_1 = require("@oriflame/lumos-common");
6
- function fromHere(filePath) {
7
- return `./${new core_1.Path(process.cwd())
8
- .relativeTo(new core_1.Path(__dirname, '../lib', filePath).resolve())
9
- .toString()}`;
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
- function getExtendsList({ future = false, node = false, typescript = false, nextjs = false, prettier = false, }) {
12
- const paths = [fromHere('./presets/base')];
13
- if (future) {
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
@@ -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": "4.3.0",
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": ">=10.16.0"
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
- "@beemo/core": "^1.1.8",
28
- "@beemo/driver-eslint": "^1.2.3",
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
- "@types/confusing-browser-globals": "^1.0.0",
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
- "gitHead": "82c127cb45ef16c0937f17e5f9bb03d53fba155a"
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 { Path } from '@beemo/core';
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 fromHere(filePath: string): string {
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): string[] {
25
- const paths = [fromHere('./presets/base')];
18
+ }: ESLintOptions): ESLintConfig {
19
+ const presets = ['oriflame'];
26
20
 
27
21
  if (future) {
28
- paths.push(fromHere('./presets/future'));
22
+ presets.push('oriflame/future');
29
23
  }
30
24
 
31
25
  if (node) {
32
- paths.push(fromHere('./presets/node'));
26
+ presets.push('oriflame/node');
33
27
  }
34
28
 
35
29
  if (typescript) {
36
- paths.push(fromHere('./presets/typescript'));
30
+ presets.push('oriflame/typescript');
37
31
  }
38
32
 
39
33
  if (nextjs) {
40
- paths.push(fromHere('./presets/nextjs'));
34
+ presets.push('oriflame/nextjs');
41
35
  }
42
36
 
43
37
  if (prettier) {
44
- paths.push(fromHere('./presets/prettier'));
38
+ presets.push('oriflame/prettier');
45
39
  }
46
40
 
47
- return paths;
48
- }
49
-
50
- export function getIgnoreList(): string[] {
51
- return [
52
- ...IGNORE_PATHS,
53
- 'jest.config.js',
54
- 'babel.config.js',
55
- 'webpack.config.js',
56
- 'build*/',
57
- '\\.eslintrc.js',
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
  }