@perfective/eslint-config 0.28.0 → 0.29.0

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/README.adoc CHANGED
@@ -61,35 +61,52 @@ npm install --save-dev \
61
61
  typescript-eslint
62
62
  ----
63
63
  +
64
+ . Require the configuration in your root `eslint.config.js`.
65
+ +
66
+ [source,javascript]
67
+ ----
68
+ const perfectiveEslintConfig = require('@perfective/eslint-config');
69
+
70
+ module.exports = perfectiveEslintConfig.default;
71
+ ----
72
+ +
73
+ . `*.d.ts` files and `dist` directories are ignored by the configuration.
74
+ `node_modules` and dot-files are ignored by the `eslint`.
75
+ If more directories or file types need to be ignored, see the
76
+ `link:https://eslint.org/docs/user-guide/configuring/ignoring-code#the-eslintignore-file[.eslintignore]` file docs.
77
+ +
64
78
  . Install optional peer dependencies that add linting rules for the tools you use.
65
79
  +
66
80
  [source,bash]
67
81
  ----
68
82
  npm install --save-dev \
83
+ @smarttools/eslint-plugin-rxjs \
69
84
  eslint-plugin-cypress \
70
85
  eslint-plugin-jest \
71
86
  eslint-plugin-jest-dom \
72
- eslint-plugin-rxjs \
73
87
  eslint-plugin-testing-library
74
88
  ----
75
89
  +
76
- The `@perfective/eslint-config` automatically includes rules for these plugins,
77
- if the dependency is installed.
78
- +
79
- . Require the configuration in your root `eslint.config.js`.
90
+ . Add optional configurations to your root `eslint.config.js`.
80
91
  +
81
92
  [source,javascript]
82
93
  ----
83
94
  const perfectiveEslintConfig = require('@perfective/eslint-config');
95
+ const perfectiveCypressConfig = require('@perfective/eslint-config/cypress');
96
+ const perfectiveJestConfig = require('@perfective/eslint-config/jest');
97
+ const perfectiveJestDomConfig = require('@perfective/eslint-config/jesd-dom');
98
+ const perfectiveRxjsConfig = require('@perfective/eslint-config/rxjs');
99
+ const perfectiveTestingLibraryConfig = require('@perfective/eslint-config/testing-library');
84
100
 
85
- module.exports = perfectiveEslintConfig.default;
101
+ module.exports = [
102
+ ...perfectiveEslintConfig.default,
103
+ perfectiveCypressConfig.cypressConfig(),
104
+ perfectiveJestConfig.jestConfig(),
105
+ perfectiveJestDomConfig.jestDomConfig(),
106
+ perfectiveRxjsConfig.rxjsConfig(),
107
+ perfectiveTestingLibraryConfig.testingLibrarysConfig(),
108
+ ];
86
109
  ----
87
- +
88
- . `*.d.ts` files and `dist` directories are ignored by the configuration.
89
- `node_modules` and dot-files are ignored by the `eslint`.
90
- If more directories or file types need to be ignored, see the
91
- `link:https://eslint.org/docs/user-guide/configuring/ignoring-code#the-eslintignore-file[.eslintignore]` file docs.
92
-
93
110
 
94
111
  == Rules Configuration Extension Functions
95
112
 
@@ -135,22 +152,3 @@ for the `simple-import-sort/imports` rule.
135
152
  * `unicornPreventAbbreviations(replacements, options)`
136
153
  — extends and overrides the list of `replacements`
137
154
  and `options` for the `unicorn/prevent-abbreviation` rule.
138
-
139
-
140
- == Internals
141
-
142
- The rules for each plugin are described in the `./src/rules/{plugin}` subdirectories,
143
- where the `{plugin}` is the name of the plugin (after the `eslint-plugin-` prefix).
144
- Each configuration is exported from the `./index.ts` file
145
- and is organized as a partial ESLint config.
146
- It should contain the plugin name and the list of the rules, sorted alphabetically.
147
- When a plugin's documentation groups rules,
148
- each group is configured in a separate file
149
- and then extended in the `./index.ts` file.
150
-
151
- The final configuration extends each plugin configuration on a file-type basis.
152
-
153
-
154
- == Roadmap
155
-
156
- * Add the `@perfective/eslint-plugin` with the rules for working with the `@perfective` packages.
package/README.md CHANGED
@@ -59,24 +59,44 @@ from issues that will be fixed automatically.
59
59
  typescript-eslint
60
60
  ```
61
61
 
62
- 2. Install optional peer dependencies that add linting rules for the tools you use.
62
+ 2. Require the configuration in your root `eslint.config.js`.
63
+
64
+ ```javascript
65
+ const perfectiveEslintConfig = require('@perfective/eslint-config');
66
+
67
+ module.exports = perfectiveEslintConfig.default;
68
+ ```
69
+
70
+ 3. Install optional peer dependencies that add linting rules for the tools you use.
63
71
 
64
72
  ```bash
65
73
  npm install --save-dev \
74
+ @smarttools/eslint-plugin-rxjs \
66
75
  eslint-plugin-cypress \
67
76
  eslint-plugin-jest \
68
77
  eslint-plugin-jest-dom \
69
- eslint-plugin-rxjs \
70
78
  eslint-plugin-testing-library
71
79
  ```
72
80
 
73
81
  The `@perfective/eslint-config` automatically includes rules for these plugins,
74
82
  if the dependency is installed.
75
83
 
76
- 3. Require the configuration in your root `eslint.config.js`.
84
+ 4. Add optional configurations to your root `eslint.config.js`.
77
85
 
78
86
  ```javascript
79
87
  const perfectiveEslintConfig = require('@perfective/eslint-config');
88
+ const perfectiveCypressConfig = require('@perfective/eslint-config/cypress');
89
+ const perfectiveJestConfig = require('@perfective/eslint-config/jest');
90
+ const perfectiveJestDomConfig = require('@perfective/eslint-config/jesd-dom');
91
+ const perfectiveRxjsConfig = require('@perfective/eslint-config/rxjs');
92
+ const perfectiveTestingLibraryConfig = require('@perfective/eslint-config/testing-library');
80
93
 
81
- module.exports = perfectiveEslintConfig.default;
94
+ module.exports = [
95
+ ...perfectiveEslintConfig.default,
96
+ perfectiveCypressConfig.cypressConfig(),
97
+ perfectiveJestConfig.jestConfig(),
98
+ perfectiveJestDomConfig.jestDomConfig(),
99
+ perfectiveRxjsConfig.rxjsConfig(),
100
+ perfectiveTestingLibraryConfig.testingLibrarysConfig(),
101
+ ];
82
102
  ```
@@ -1,5 +1,2 @@
1
- export declare function optionalConfig(plugin: string, rules: Record<string, unknown>): Record<string, unknown>;
2
- export declare function optionalOverrides(plugin: string, overrides: Record<string, unknown>): Record<string, unknown> | null;
3
- export declare function optionalRules(plugin: string): string | null;
4
1
  export declare function optionalRule(rule: string, config: unknown): Record<string, unknown>;
5
2
  export declare function hasEslintPlugin(plugin: string): boolean;
package/config/plugin.js CHANGED
@@ -1,32 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optionalConfig = optionalConfig;
4
- exports.optionalOverrides = optionalOverrides;
5
- exports.optionalRules = optionalRules;
6
3
  exports.optionalRule = optionalRule;
7
4
  exports.hasEslintPlugin = hasEslintPlugin;
8
5
  const node_1 = require("./node");
9
- function optionalConfig(plugin, rules) {
10
- if (hasEslintPlugin(plugin)) {
11
- return {
12
- plugins: [plugin],
13
- rules,
14
- };
15
- }
16
- return {};
17
- }
18
- function optionalOverrides(plugin, overrides) {
19
- if (hasEslintPlugin(plugin)) {
20
- return overrides;
21
- }
22
- return null;
23
- }
24
- function optionalRules(plugin) {
25
- if (hasEslintPlugin(plugin)) {
26
- return `./rules/${plugin.replace(/^@/u, '')}`;
27
- }
28
- return null;
29
- }
30
6
  function optionalRule(rule, config) {
31
7
  const plugin = pluginOfRule(rule);
32
8
  if (plugin === null) {
package/config.d.ts CHANGED
@@ -1 +1 @@
1
- export { hasEslintPlugin, optionalConfig, optionalOverrides, optionalRule, optionalRules, } from './config/plugin';
1
+ export { hasEslintPlugin, optionalRule, } from './config/plugin';
package/config.js CHANGED
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optionalRules = exports.optionalRule = exports.optionalOverrides = exports.optionalConfig = exports.hasEslintPlugin = void 0;
3
+ exports.optionalRule = exports.hasEslintPlugin = void 0;
4
4
  var plugin_1 = require("./config/plugin");
5
5
  Object.defineProperty(exports, "hasEslintPlugin", { enumerable: true, get: function () { return plugin_1.hasEslintPlugin; } });
6
- Object.defineProperty(exports, "optionalConfig", { enumerable: true, get: function () { return plugin_1.optionalConfig; } });
7
- Object.defineProperty(exports, "optionalOverrides", { enumerable: true, get: function () { return plugin_1.optionalOverrides; } });
8
6
  Object.defineProperty(exports, "optionalRule", { enumerable: true, get: function () { return plugin_1.optionalRule; } });
9
- Object.defineProperty(exports, "optionalRules", { enumerable: true, get: function () { return plugin_1.optionalRules; } });
package/cypress.js ADDED
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.cypressConfig = cypressConfig;
37
+ const tsEslint = __importStar(require("typescript-eslint"));
38
+ const cypress_1 = require("./rules/cypress");
39
+ const no_extraneous_dependencies_1 = require("./rules/import/rules/no-extraneous-dependencies");
40
+ function cypressConfig(files = ['cypress/**/*.[jt]s']) {
41
+ return {
42
+ files,
43
+ languageOptions: Object.assign(Object.assign({}, cypress_1.cypressOptionalConfig.languageOptions), { parser: tsEslint.parser, parserOptions: {
44
+ ecmaVersion: 6,
45
+ ecmaFeatures: {
46
+ globalReturn: false,
47
+ impliedStrict: true,
48
+ },
49
+ sourceType: 'module',
50
+ project: './tsconfig.json',
51
+ warnOnUnsupportedTypeScriptVersion: true,
52
+ } }),
53
+ plugins: Object.assign({}, cypress_1.cypressOptionalConfig.plugins),
54
+ rules: Object.assign(Object.assign({}, cypress_1.cypressOptionalConfig.rules), { 'init-declarations': 'off', '@typescript-eslint/init-declarations': 'off', 'import/no-extraneous-dependencies': ['error', (0, no_extraneous_dependencies_1.cypressImportNoExtraneousDependencies)()], 'max-nested-callbacks': ['error', 4], 'new-cap': ['error', {
55
+ capIsNewExceptions: ['Given', 'When', 'Then', 'And', 'But', 'Before', 'After'],
56
+ }] }),
57
+ };
58
+ }
package/index.js CHANGED
@@ -35,27 +35,21 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const tsEslint = __importStar(require("typescript-eslint"));
37
37
  const babelParser = __importStar(require("@babel/eslint-parser"));
38
- const plugin_1 = require("./config/plugin");
39
38
  const array_func_1 = require("./rules/array-func");
40
- const cypress_1 = require("./rules/cypress");
41
39
  const eslint_1 = require("./rules/eslint");
42
40
  const eslint_comments_1 = require("./rules/eslint-comments");
43
41
  const import_1 = require("./rules/import");
44
42
  const no_extraneous_dependencies_1 = require("./rules/import/rules/no-extraneous-dependencies");
45
- const jest_1 = require("./rules/jest");
46
- const jest_dom_1 = require("./rules/jest-dom");
47
43
  const jsdoc_1 = require("./rules/jsdoc");
48
44
  const n_1 = require("./rules/n");
49
45
  const prefer_arrow_1 = require("./rules/prefer-arrow");
50
46
  const promise_1 = require("./rules/promise");
51
- const rxjs_1 = require("./rules/rxjs");
52
47
  const security_1 = require("./rules/security");
53
48
  const simple_import_sort_1 = require("./rules/simple-import-sort");
54
49
  const js_1 = require("./rules/stylistic/js");
55
50
  const jsx_1 = require("./rules/stylistic/jsx");
56
51
  const plus_1 = require("./rules/stylistic/plus");
57
52
  const ts_1 = require("./rules/stylistic/ts");
58
- const testing_library_1 = require("./rules/testing-library");
59
53
  const typescript_eslint_1 = require("./rules/typescript-eslint");
60
54
  const unicorn_1 = require("./rules/unicorn");
61
55
  exports.default = [
@@ -128,7 +122,7 @@ exports.default = [
128
122
  warnOnUnsupportedTypeScriptVersion: true,
129
123
  },
130
124
  },
131
- plugins: Object.assign(Object.assign(Object.assign({}, typescript_eslint_1.typescriptEslintConfig.plugins), ts_1.stylisticTsConfig.plugins), (0, plugin_1.hasEslintPlugin)('rxjs') ? rxjs_1.rxjsConfig.plugins : {}),
125
+ plugins: Object.assign(Object.assign({}, typescript_eslint_1.typescriptEslintConfig.plugins), ts_1.stylisticTsConfig.plugins),
132
126
  settings: {
133
127
  'import/parsers': {
134
128
  '@typescript-eslint/parser': [
@@ -143,38 +137,11 @@ exports.default = [
143
137
  },
144
138
  },
145
139
  },
146
- rules: Object.assign(Object.assign(Object.assign({}, typescript_eslint_1.typescriptEslintConfig.rules), ts_1.stylisticTsConfig.rules), (0, plugin_1.hasEslintPlugin)('rxjs') ? rxjs_1.rxjsConfig.rules : {}),
140
+ rules: Object.assign(Object.assign({}, typescript_eslint_1.typescriptEslintConfig.rules), ts_1.stylisticTsConfig.rules),
147
141
  },
148
142
  {
149
143
  files: ['**/*.js?(x)'],
150
144
  plugins: Object.assign({}, jsx_1.stylisticJsxConfig.plugins),
151
145
  rules: Object.assign({}, jsx_1.stylisticJsxConfig.rules),
152
146
  },
153
- (0, plugin_1.hasEslintPlugin)('jest') ? {
154
- files: ['**/*.@(spec|test).[jt]s?(x)'],
155
- plugins: Object.assign(Object.assign(Object.assign({}, jest_1.jestConfig.plugins), (0, plugin_1.hasEslintPlugin)('jest-dom') ? jest_dom_1.jestDomConfig.plugins : {}), (0, plugin_1.hasEslintPlugin)('testing-library') ? testing_library_1.testingLibraryConfig.plugins : {}),
156
- rules: Object.assign(Object.assign(Object.assign(Object.assign({}, jest_1.jestConfig.rules), (0, plugin_1.hasEslintPlugin)('jest-dom') ? jest_dom_1.jestDomConfig.rules : {}), (0, plugin_1.hasEslintPlugin)('testing-library') ? testing_library_1.testingLibraryConfig.rules : {}), { '@typescript-eslint/ban-ts-comment': ['error', {
157
- 'ts-expect-error': 'allow-with-description',
158
- 'ts-ignore': true,
159
- 'ts-nocheck': true,
160
- 'ts-check': false,
161
- }], '@typescript-eslint/init-declarations': 'off', '@typescript-eslint/unbound-method': 'off', 'import/no-extraneous-dependencies': ['error', (0, no_extraneous_dependencies_1.jestImportNoExtraneousDependencies)()], 'import/no-unassigned-import': ['error', {
162
- allow: [
163
- '@testing-library/jest-dom',
164
- '@testing-library/jest-dom/extend-expect',
165
- ],
166
- }], 'max-nested-callbacks': ['error', 6], 'n/no-unpublished-import': ['error', {
167
- allowModules: ['@jest/globals'],
168
- }], 'prefer-arrow/prefer-arrow-functions': 'off', 'promise/always-return': 'off', 'rxjs/no-topromise': 'off' }),
169
- } : null,
170
- (0, plugin_1.hasEslintPlugin)('cypress') ? {
171
- files: ['cypress/**/*.[jt]s'],
172
- env: {
173
- 'cypress/globals': true,
174
- },
175
- plugins: Object.assign({}, cypress_1.cypressOptionalConfig.plugins),
176
- rules: Object.assign(Object.assign({}, cypress_1.cypressOptionalConfig.rules), { 'init-declarations': 'off', '@typescript-eslint/init-declarations': 'off', 'import/no-extraneous-dependencies': ['error', (0, no_extraneous_dependencies_1.cypressImportNoExtraneousDependencies)()], 'max-nested-callbacks': ['error', 4], 'new-cap': ['error', {
177
- capIsNewExceptions: ['Given', 'When', 'Then', 'And', 'But', 'Before', 'After'],
178
- }] }),
179
- } : null,
180
147
  ].filter(Boolean);
package/jest-dom.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jestDomConfig = jestDomConfig;
4
+ const jest_dom_1 = require("./rules/jest-dom");
5
+ function jestDomConfig(files = ['**/*.@(spec|test).[jt]s?(x)']) {
6
+ return {
7
+ files,
8
+ plugins: jest_dom_1.jestDomConfig.plugins,
9
+ rules: jest_dom_1.jestDomConfig.rules,
10
+ };
11
+ }
package/jest.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jestConfig = jestConfig;
4
+ const no_extraneous_dependencies_1 = require("./rules/import/rules/no-extraneous-dependencies");
5
+ const jest_1 = require("./rules/jest");
6
+ function jestConfig(files = ['**/*.@(spec|test).[jt]s?(x)']) {
7
+ return {
8
+ files,
9
+ plugins: jest_1.jestConfig.plugins,
10
+ rules: Object.assign(Object.assign({}, jest_1.jestConfig.rules), { '@typescript-eslint/ban-ts-comment': ['error', {
11
+ 'ts-expect-error': 'allow-with-description',
12
+ 'ts-ignore': true,
13
+ 'ts-nocheck': true,
14
+ 'ts-check': false,
15
+ }], '@typescript-eslint/init-declarations': 'off', '@typescript-eslint/unbound-method': 'off', 'import/no-extraneous-dependencies': ['error', (0, no_extraneous_dependencies_1.jestImportNoExtraneousDependencies)()], 'import/no-unassigned-import': ['error', {
16
+ allow: [
17
+ '@testing-library/jest-dom',
18
+ '@testing-library/jest-dom/extend-expect',
19
+ ],
20
+ }], 'max-nested-callbacks': ['error', 6], 'n/no-unpublished-import': ['error', {
21
+ allowModules: ['@jest/globals'],
22
+ }], 'prefer-arrow/prefer-arrow-functions': 'off', 'promise/always-return': 'off', '@smarttools/rxjs/no-topromise': 'off' }),
23
+ };
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perfective/eslint-config",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "ESLint shareable rules configuration",
5
5
  "keywords": ["code quality", "code standard", "code style", "eslint", "eslint config", "lint", "perfective", "tslint", "tslint config", "typescript"],
6
6
  "author": "Andrey Mikheychik <a.mikheychik@gmail.com>",
@@ -12,29 +12,30 @@
12
12
  "license": "MIT",
13
13
  "peerDependencies": {
14
14
  "@babel/eslint-parser": "^7.25.9",
15
- "@stylistic/eslint-plugin": "^2.11.0",
16
- "@stylistic/eslint-plugin-js": "^2.11.0",
17
- "@stylistic/eslint-plugin-jsx": "^2.11.0",
18
- "@stylistic/eslint-plugin-plus": "^2.11.0",
19
- "@stylistic/eslint-plugin-ts": "^2.11.0",
20
- "eslint": "^8.57.1",
21
- "eslint-import-resolver-typescript": "^3.6.3",
15
+ "@smarttools/eslint-plugin-rxjs": "1.0.9",
16
+ "@stylistic/eslint-plugin": "^2.12.1",
17
+ "@stylistic/eslint-plugin-js": "^2.12.1",
18
+ "@stylistic/eslint-plugin-jsx": "^2.12.1",
19
+ "@stylistic/eslint-plugin-plus": "^2.12.1",
20
+ "@stylistic/eslint-plugin-ts": "^2.12.1",
21
+ "@typescript-eslint/utils": "^8.18.2",
22
+ "eslint": "^9.17.0",
23
+ "eslint-import-resolver-typescript": "^3.7.0",
22
24
  "eslint-plugin-array-func": "^4.0.0",
23
- "eslint-plugin-cypress": "^3.6.0",
25
+ "eslint-plugin-cypress": "^4.1.0",
24
26
  "eslint-plugin-eslint-comments": "^3.2.0",
25
27
  "eslint-plugin-import": "^2.31.0",
26
- "eslint-plugin-jest": "^28.9.0",
28
+ "eslint-plugin-jest": "^28.10.0",
27
29
  "eslint-plugin-jest-dom": "^5.5.0",
28
- "eslint-plugin-jsdoc": "^50.6.0",
29
- "eslint-plugin-n": "^17.14.0",
30
+ "eslint-plugin-jsdoc": "^50.6.1",
31
+ "eslint-plugin-n": "^17.15.1",
30
32
  "eslint-plugin-prefer-arrow": "^1.2.3",
31
33
  "eslint-plugin-promise": "^7.2.1",
32
- "eslint-plugin-rxjs": "^5.0.3",
33
34
  "eslint-plugin-security": "^3.0.1",
34
35
  "eslint-plugin-simple-import-sort": "^12.1.1",
35
- "eslint-plugin-testing-library": "^7.0.0",
36
+ "eslint-plugin-testing-library": "^7.1.1",
36
37
  "eslint-plugin-unicorn": "^56.0.1",
37
- "typescript-eslint": "^8.16.0"
38
+ "typescript-eslint": "^8.18.2"
38
39
  },
39
40
  "peerDependenciesMeta": {
40
41
  "eslint-plugin-cypress": {
@@ -69,6 +70,26 @@
69
70
  "./rules": {
70
71
  "require": "./rules.js",
71
72
  "types": "./rules.d.ts"
73
+ },
74
+ "./cypress": {
75
+ "require": "./cypress.js",
76
+ "types": "./cypress.d.ts"
77
+ },
78
+ "./jest": {
79
+ "require": "./jest.js",
80
+ "types": "./jest.d.ts"
81
+ },
82
+ "./jest-dom": {
83
+ "require": "./jest-dom.js",
84
+ "types": "./jest-dom.d.ts"
85
+ },
86
+ "./rxjs": {
87
+ "require": "./rxjs.js",
88
+ "types": "./rxjs.d.ts"
89
+ },
90
+ "./testing-library": {
91
+ "require": "./testing-library.js",
92
+ "types": "./testing-library.d.ts"
72
93
  }
73
94
  },
74
95
  "scripts": {}
@@ -34,11 +34,14 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.cypressOptionalConfig = void 0;
37
- const eslintPluginCypress = __importStar(require("eslint-plugin-cypress"));
37
+ const eslintPluginCypress = __importStar(require("eslint-plugin-cypress/flat"));
38
38
  exports.cypressOptionalConfig = {
39
39
  plugins: {
40
40
  cypress: eslintPluginCypress,
41
41
  },
42
+ languageOptions: {
43
+ globals: eslintPluginCypress.configs.globals.languageOptions.globals,
44
+ },
42
45
  rules: {
43
46
  'cypress/assertion-before-screenshot': 'error',
44
47
  'cypress/no-assigning-return-values': 'error',
@@ -32,7 +32,10 @@ exports.eslintPossibleProblemsRules = {
32
32
  'no-empty-character-class': 'error',
33
33
  'no-empty-pattern': 'error',
34
34
  'no-ex-assign': 'error',
35
- 'no-fallthrough': 'error',
35
+ 'no-fallthrough': ['error', {
36
+ allowEmptyCase: false,
37
+ reportUnusedFallthroughComment: true,
38
+ }],
36
39
  'no-func-assign': 'error',
37
40
  'no-import-assign': 'error',
38
41
  'no-inner-declarations': 'error',
@@ -45,7 +48,9 @@ exports.eslintPossibleProblemsRules = {
45
48
  skipJSXText: false,
46
49
  }],
47
50
  'no-loss-of-precision': 'error',
48
- 'no-misleading-character-class': 'error',
51
+ 'no-misleading-character-class': ['error', {
52
+ allowEscape: false,
53
+ }],
49
54
  'no-new-native-nonconstructor': 'error',
50
55
  'no-new-symbol': 'error',
51
56
  'no-obj-calls': 'error',
@@ -71,7 +76,9 @@ exports.eslintPossibleProblemsRules = {
71
76
  argsIgnorePattern: '^_',
72
77
  caughtErrors: 'all',
73
78
  destructuredArrayIgnorePattern: '^_',
79
+ ignoreClassWithStaticInitBlock: false,
74
80
  ignoreRestSiblings: false,
81
+ reportUsedIgnorePattern: false,
75
82
  vars: 'all',
76
83
  }],
77
84
  'no-use-before-define': ['error', {
@@ -81,6 +88,7 @@ exports.eslintPossibleProblemsRules = {
81
88
  allowNamedExports: false,
82
89
  }],
83
90
  'no-useless-backreference': 'error',
91
+ 'no-useless-assignment': 'error',
84
92
  'require-atomic-updates': ['error', {
85
93
  allowProperties: false,
86
94
  }],
@@ -71,7 +71,9 @@ exports.eslintSuggestionsRules = {
71
71
  'no-eval': 'error',
72
72
  'no-extend-native': 'error',
73
73
  'no-extra-bind': 'warn',
74
- 'no-extra-boolean-cast': 'warn',
74
+ 'no-extra-boolean-cast': ['warn', {
75
+ enforceForInnerExpressions: true,
76
+ }],
75
77
  'no-extra-label': 'warn',
76
78
  'no-extra-semi': 'off',
77
79
  'no-floating-decimal': 'off',
@@ -34,17 +34,17 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.rxjsConfig = void 0;
37
- const eslintPluginRxjs = __importStar(require("eslint-plugin-rxjs"));
37
+ const eslintPluginRxjs = __importStar(require("@smarttools/eslint-plugin-rxjs"));
38
38
  exports.rxjsConfig = {
39
39
  plugins: {
40
- rxjs: eslintPluginRxjs,
40
+ '@smarttools/rxjs': eslintPluginRxjs,
41
41
  },
42
42
  rules: {
43
- 'rxjs/ban-observables': 'error',
44
- 'rxjs/ban-operators': ['error', {
43
+ '@smarttools/rxjs/ban-observables': 'error',
44
+ '@smarttools/rxjs/ban-operators': ['error', {
45
45
  tap: false,
46
46
  }],
47
- 'rxjs/finnish': ['error', {
47
+ '@smarttools/rxjs/finnish': ['error', {
48
48
  functions: true,
49
49
  methods: true,
50
50
  names: {},
@@ -54,44 +54,43 @@ exports.rxjsConfig = {
54
54
  types: {},
55
55
  variables: true,
56
56
  }],
57
- 'rxjs/just': 'off',
58
- 'rxjs/no-async-subscribe': 'error',
59
- 'rxjs/no-compat': 'error',
60
- 'rxjs/no-connectable': 'error',
61
- 'rxjs/no-create': 'error',
62
- 'rxjs/no-cyclic-action': 'error',
63
- 'rxjs/no-explicit-generics': 'off',
64
- 'rxjs/no-exposed-subjects': 'error',
65
- 'rxjs/no-finnish': 'off',
66
- 'rxjs/no-ignored-error': 'error',
67
- 'rxjs/no-ignored-notifier': 'error',
68
- 'rxjs/no-ignored-observable': 'error',
69
- 'rxjs/no-ignored-replay-buffer': 'error',
70
- 'rxjs/no-ignored-subscribe': 'error',
71
- 'rxjs/no-ignored-subscription': 'error',
72
- 'rxjs/no-ignored-takewhile-value': 'error',
73
- 'rxjs/no-implicit-any-catch': ['off', {
57
+ '@smarttools/rxjs/just': 'off',
58
+ '@smarttools/rxjs/no-async-subscribe': 'error',
59
+ '@smarttools/rxjs/no-compat': 'error',
60
+ '@smarttools/rxjs/no-connectable': 'error',
61
+ '@smarttools/rxjs/no-create': 'error',
62
+ '@smarttools/rxjs/no-cyclic-action': 'error',
63
+ '@smarttools/rxjs/no-explicit-generics': 'off',
64
+ '@smarttools/rxjs/no-exposed-subjects': 'error',
65
+ '@smarttools/rxjs/no-finnish': 'off',
66
+ '@smarttools/rxjs/no-ignored-error': 'error',
67
+ '@smarttools/rxjs/no-ignored-notifier': 'error',
68
+ '@smarttools/rxjs/no-ignored-observable': 'error',
69
+ '@smarttools/rxjs/no-ignored-replay-buffer': 'error',
70
+ '@smarttools/rxjs/no-ignored-subscribe': 'error',
71
+ '@smarttools/rxjs/no-ignored-subscription': 'error',
72
+ '@smarttools/rxjs/no-ignored-takewhile-value': 'error',
73
+ '@smarttools/rxjs/no-implicit-any-catch': ['off', {
74
74
  allowExplicitAny: false,
75
75
  }],
76
- 'rxjs/no-index': 'error',
77
- 'rxjs/no-internal': 'warn',
78
- 'rxjs/no-nested-subscribe': 'error',
79
- 'rxjs/no-redundant-notify': 'error',
80
- 'rxjs/no-sharereplay': 'off',
81
- 'rxjs/no-subclass': 'error',
82
- 'rxjs/no-subject-unsubscribe': 'error',
83
- 'rxjs/no-subject-value': 'error',
84
- 'rxjs/no-subscribe-handlers': 'off',
85
- 'rxjs/no-tap': 'off',
86
- 'rxjs/no-topromise': 'error',
87
- 'rxjs/no-unbound-methods': 'error',
88
- 'rxjs/no-unsafe-catch': 'error',
89
- 'rxjs/no-unsafe-first': 'error',
90
- 'rxjs/no-unsafe-subject-next': 'error',
91
- 'rxjs/no-unsafe-switchmap': 'error',
92
- 'rxjs/no-unsafe-takeuntil': 'error',
93
- 'rxjs/prefer-observer': 'off',
94
- 'rxjs/suffix-subjects': 'off',
95
- 'rxjs/throw-error': 'error',
76
+ '@smarttools/rxjs/no-index': 'error',
77
+ '@smarttools/rxjs/no-internal': 'warn',
78
+ '@smarttools/rxjs/no-nested-subscribe': 'error',
79
+ '@smarttools/rxjs/no-redundant-notify': 'error',
80
+ '@smarttools/rxjs/no-sharereplay': 'off',
81
+ '@smarttools/rxjs/no-subclass': 'error',
82
+ '@smarttools/rxjs/no-subject-unsubscribe': 'error',
83
+ '@smarttools/rxjs/no-subject-value': 'error',
84
+ '@smarttools/rxjs/no-subscribe-handlers': 'off',
85
+ '@smarttools/rxjs/no-topromise': 'error',
86
+ '@smarttools/rxjs/no-unbound-methods': 'error',
87
+ '@smarttools/rxjs/no-unsafe-catch': 'error',
88
+ '@smarttools/rxjs/no-unsafe-first': 'error',
89
+ '@smarttools/rxjs/no-unsafe-subject-next': 'error',
90
+ '@smarttools/rxjs/no-unsafe-switchmap': 'error',
91
+ '@smarttools/rxjs/no-unsafe-takeuntil': 'error',
92
+ '@smarttools/rxjs/prefer-observer': 'off',
93
+ '@smarttools/rxjs/suffix-subjects': 'off',
94
+ '@smarttools/rxjs/throw-error': 'error',
96
95
  },
97
96
  };
package/rxjs.js ADDED
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.rxjsConfig = rxjsConfig;
37
+ const tsEslint = __importStar(require("typescript-eslint"));
38
+ const rxjs_1 = require("./rules/rxjs");
39
+ function rxjsConfig(files = ['**/*.ts?(x)']) {
40
+ return {
41
+ files,
42
+ languageOptions: {
43
+ parser: tsEslint.parser,
44
+ parserOptions: {
45
+ ecmaVersion: 6,
46
+ ecmaFeatures: {
47
+ globalReturn: false,
48
+ impliedStrict: true,
49
+ },
50
+ sourceType: 'module',
51
+ project: './tsconfig.json',
52
+ warnOnUnsupportedTypeScriptVersion: true,
53
+ },
54
+ },
55
+ plugins: Object.assign({}, rxjs_1.rxjsConfig.plugins),
56
+ rules: Object.assign({}, rxjs_1.rxjsConfig.rules),
57
+ };
58
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testingLibraryConfig = testingLibraryConfig;
4
+ const testing_library_1 = require("./rules/testing-library");
5
+ function testingLibraryConfig(files = ['**/*.@(spec|test).[jt]s?(x)']) {
6
+ return {
7
+ files,
8
+ plugins: testing_library_1.testingLibraryConfig.plugins,
9
+ rules: testing_library_1.testingLibraryConfig.rules,
10
+ };
11
+ }