@dartess/eslint-plugin 0.6.0 → 0.8.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/CHANGELOG.md +15 -0
- package/README.md +19 -17
- package/dist/configs/mobx.d.ts +2 -2
- package/dist/configs/mobx.js +5 -4
- package/dist/configs/next.d.ts +2 -2
- package/dist/configs/post-format.d.ts +1 -1
- package/dist/configs/react.js +3 -16
- package/dist/configs/recommended.js +10 -9
- package/dist/configs/storybook.d.ts +1 -1
- package/dist/configs/storybook.js +4 -3
- package/dist/configs/utils/convertWarnsToErrorsIfNeeded.d.ts +4 -0
- package/dist/configs/utils/convertWarnsToErrorsIfNeeded.js +36 -0
- package/dist/configs/vendor-rules/imports.d.ts +0 -2
- package/dist/configs/vendor-rules/imports.js +0 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -13
- package/dist/rules/{max-parent-import-depth.js → imports-max-parent-depth.js} +1 -1
- package/dist/rules/{prevent-mixing-external-and-internal-classes.js → jsx-no-cross-context-classes.js} +1 -1
- package/dist/rules/{jsx-text-as-child.js → jsx-no-text-as-child.js} +1 -1
- package/dist/rules/{require-observer.js → mobx-require-observer.js} +1 -1
- package/dist/rules/{strict-observable-components-declaration.js → mobx-strict-observable-components-declaration.js} +1 -1
- package/docs/rules/{max-parent-import-depth.md → imports-max-parent-depth.md} +1 -1
- package/docs/rules/{prevent-mixing-external-and-internal-classes.md → jsx-no-cross-context-classes.md} +1 -1
- package/docs/rules/{require-observer.md → mobx-require-observer.md} +1 -1
- package/docs/rules/{strict-observable-components-declaration.md → mobx-strict-observable-components-declaration.md} +3 -3
- package/docs/rules/mobx-sync-action.md +1 -1
- package/docs/rules/mobx-sync-autorun.md +1 -1
- package/docs/rules/stories-export-meta.md +1 -1
- package/docs/rules/stories-export-typed.md +1 -1
- package/package.json +1 -1
- /package/dist/rules/{max-parent-import-depth.d.ts → imports-max-parent-depth.d.ts} +0 -0
- /package/dist/rules/{prevent-mixing-external-and-internal-classes.d.ts → jsx-no-cross-context-classes.d.ts} +0 -0
- /package/dist/rules/{jsx-text-as-child.d.ts → jsx-no-text-as-child.d.ts} +0 -0
- /package/dist/rules/{require-observer.d.ts → mobx-require-observer.d.ts} +0 -0
- /package/dist/rules/{strict-observable-components-declaration.d.ts → mobx-strict-observable-components-declaration.d.ts} +0 -0
- /package/docs/rules/{jsx-text-as-child.md → jsx-no-text-as-child.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[//]: # (https://keepachangelog.com/en/1.1.0/)
|
|
4
4
|
|
|
5
|
+
## [0.8.0] - 2026-01-22
|
|
6
|
+
|
|
7
|
+
- All recommended warnings are converted to errors because warnings are useless.
|
|
8
|
+
|
|
9
|
+
## [0.7.1] - 2026-01-18
|
|
10
|
+
- rename some rules for more clear naming and consistency:
|
|
11
|
+
|
|
12
|
+
* `jsx-text-as-child` -> `jsx-no-text-as-child`
|
|
13
|
+
* `prevent-mixing-external-and-internal-classes` -> `jsx-no-cross-context-classes`
|
|
14
|
+
* `max-parent-import-depth` -> `imports-max-parent-depth`
|
|
15
|
+
* `strict-observable-components-declaration` -> `mobx-strict-observable-components-declaration`
|
|
16
|
+
* `require-observer` -> `mobx-require-observer`
|
|
17
|
+
|
|
18
|
+
Please, rename rules in your config, if you're using them directly
|
|
19
|
+
|
|
5
20
|
## [0.6.0] - 2026-01-17
|
|
6
21
|
- replace legacy `eslint-plugin-react` with modern `@eslint-react/eslint-plugin`
|
|
7
22
|
|
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ Also can extends (if it is applicable)
|
|
|
17
17
|
* `eslint-plugin-mobx` — `recommended`
|
|
18
18
|
* `eslint-plugin-storybook` — `recommended` & `csf-strict`
|
|
19
19
|
|
|
20
|
+
_Note: all recommended warnings are converted to errors because warnings are useless._
|
|
21
|
+
|
|
20
22
|
All of it pinched with extra configs, setups and extra rules. Just take it and use it!
|
|
21
23
|
|
|
22
24
|
### Notes
|
|
@@ -158,23 +160,23 @@ Each rule has emojis denoting:
|
|
|
158
160
|
- 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
|
|
159
161
|
- 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
|
|
160
162
|
|
|
161
|
-
| Name
|
|
162
|
-
|
|
163
|
-
| **imports**
|
|
164
|
-
| [max-parent-
|
|
165
|
-
| **TypeScript**
|
|
166
|
-
| [ts-named-tuple-elements](docs/rules/ts-named-tuple-elements.md)
|
|
167
|
-
| **React**
|
|
168
|
-
| [jsx-no-text-as-child](docs/rules/jsx-text-as-child.md)
|
|
169
|
-
| [
|
|
170
|
-
| **Storybook**
|
|
171
|
-
| [stories-export-meta](docs/rules/stories-export-meta.md)
|
|
172
|
-
| [stories-export-typed](docs/rules/stories-export-typed.md)
|
|
173
|
-
| **MobX**
|
|
174
|
-
| [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md)
|
|
175
|
-
| [require-observer](docs/rules/require-observer.md)
|
|
176
|
-
| [mobx-sync-autorun](docs/rules/mobx-sync-autorun.md)
|
|
177
|
-
| [mobx-sync-action](docs/rules/mobx-sync-action.md)
|
|
163
|
+
| Name | Description | ✅ | 🔧 | 💡 |
|
|
164
|
+
|:-------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
|
|
165
|
+
| **imports** | _config: recommended_ | | | |
|
|
166
|
+
| [imports-max-parent-depth](docs/rules/imports-max-parent-depth.md) | Limit relative imports to a maximum parent depth. | ✅ | | |
|
|
167
|
+
| **TypeScript** | _config: recommended_ | | | |
|
|
168
|
+
| [ts-named-tuple-elements](docs/rules/ts-named-tuple-elements.md) | Enforce (or forbid) named tuple elements | ✅ | | |
|
|
169
|
+
| **React** | _config: react_ | | | |
|
|
170
|
+
| [jsx-no-text-as-child](docs/rules/jsx-no-text-as-child.md) | JSX elements should not have text without translation | | | |
|
|
171
|
+
| [jsx-no-cross-context-classes](docs/rules/jsx-no-cross-context-classes.md) | Prevent mixing of outer and inner classes to avoid dependency on style order. | | | |
|
|
172
|
+
| **Storybook** | _config: storybook_ | | | |
|
|
173
|
+
| [stories-export-meta](docs/rules/stories-export-meta.md) | Storybook's Meta should be typed | ✅ | | |
|
|
174
|
+
| [stories-export-typed](docs/rules/stories-export-typed.md) | Storybook's Stories should be typed | ✅ | | |
|
|
175
|
+
| **MobX** | _config: mobx_ | | | |
|
|
176
|
+
| [mobx-strict-observable-components-declaration](docs/rules/mobx-strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | ✅ | | |
|
|
177
|
+
| [mobx-require-observer](docs/rules/mobx-require-observer.md) | Components using the stores must be wrapped in an `observer` | ✅ | 🔧 | |
|
|
178
|
+
| [mobx-sync-autorun](docs/rules/mobx-sync-autorun.md) | Enforce synchronous autorun callback | ✅ | | |
|
|
179
|
+
| [mobx-sync-action](docs/rules/mobx-sync-action.md) | Enforce synchronous actions | ✅ | | |
|
|
178
180
|
|
|
179
181
|
## Code Reuse Policy
|
|
180
182
|
|
package/dist/configs/mobx.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const config:
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const config: TSESLint.FlatConfig.ConfigArray;
|
|
3
3
|
export default config;
|
package/dist/configs/mobx.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import pluginMobx from 'eslint-plugin-mobx';
|
|
2
|
+
import { convertWarnsToErrorsIfNeeded } from "./utils/convertWarnsToErrorsIfNeeded.js";
|
|
2
3
|
const config = [
|
|
3
|
-
pluginMobx.flatConfigs.recommended,
|
|
4
|
+
convertWarnsToErrorsIfNeeded(pluginMobx.flatConfigs.recommended),
|
|
4
5
|
{
|
|
5
6
|
name: '@dartess/mobx',
|
|
6
7
|
rules: {
|
|
7
|
-
'mobx/missing-observer': 'off', // replaced by the neater "@dartess/require-observer"
|
|
8
|
+
'mobx/missing-observer': 'off', // replaced by the neater "@dartess/mobx-require-observer"
|
|
8
9
|
'mobx/missing-make-observable': 'off', // useless with modern decorators syntax. TODO check original plugin?
|
|
9
|
-
'@dartess/strict-observable-components-declaration': 'error',
|
|
10
|
-
'@dartess/require-observer': 'error',
|
|
10
|
+
'@dartess/mobx-strict-observable-components-declaration': 'error',
|
|
11
|
+
'@dartess/mobx-require-observer': 'error',
|
|
11
12
|
'@dartess/mobx-sync-autorun': 'error', // TODO implement it by types?
|
|
12
13
|
'@dartess/mobx-sync-action': 'error', // TODO implement it by types?
|
|
13
14
|
},
|
package/dist/configs/next.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const config:
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const config: TSESLint.FlatConfig.ConfigArray;
|
|
3
3
|
export default config;
|
package/dist/configs/react.js
CHANGED
|
@@ -2,6 +2,7 @@ import eslintReact from '@eslint-react/eslint-plugin';
|
|
|
2
2
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
3
3
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
4
4
|
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
5
|
+
import { convertWarnsToErrorsIfNeeded } from "./utils/convertWarnsToErrorsIfNeeded.js";
|
|
5
6
|
const config = [
|
|
6
7
|
{
|
|
7
8
|
name: '@dartess/react-setup',
|
|
@@ -16,8 +17,8 @@ const config = [
|
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
|
-
eslintReact.configs['strict-type-checked'],
|
|
20
|
-
reactHooksPlugin.configs.flat.recommended,
|
|
20
|
+
convertWarnsToErrorsIfNeeded(eslintReact.configs['strict-type-checked']),
|
|
21
|
+
convertWarnsToErrorsIfNeeded(reactHooksPlugin.configs.flat.recommended),
|
|
21
22
|
{
|
|
22
23
|
name: '@dartess/react',
|
|
23
24
|
files: ['**/*.{jsx,tsx}'],
|
|
@@ -51,20 +52,6 @@ const config = [
|
|
|
51
52
|
'@eslint-react/naming-convention/filename': 'error', // enforce corrent filename
|
|
52
53
|
// disable some recommended rules
|
|
53
54
|
'@eslint-react/prefer-destructuring-assignment': 'off', // can break discriminated union types
|
|
54
|
-
// mark some recommended warns as errors
|
|
55
|
-
'@eslint-react/dom/no-missing-button-type': 'error',
|
|
56
|
-
'@eslint-react/naming-convention/use-state': 'error',
|
|
57
|
-
'@eslint-react/naming-convention/ref-name': 'error',
|
|
58
|
-
'@eslint-react/naming-convention/context-name': 'error',
|
|
59
|
-
'@eslint-react/dom/no-missing-iframe-sandbox': 'error',
|
|
60
|
-
'@eslint-react/dom/no-unsafe-iframe-sandbox': 'error',
|
|
61
|
-
'@eslint-react/jsx-no-comment-textnodes': 'error',
|
|
62
|
-
'@eslint-react/no-unstable-context-value': 'error',
|
|
63
|
-
'@eslint-react/dom/no-script-url': 'error',
|
|
64
|
-
'@eslint-react/dom/no-unsafe-target-blank': 'error',
|
|
65
|
-
'@eslint-react/no-useless-fragment': 'error',
|
|
66
|
-
'@eslint-react/dom/no-dangerously-set-innerhtml': 'error',
|
|
67
|
-
'@eslint-react/no-forward-ref': 'error',
|
|
68
55
|
// enable airbnb-style rules
|
|
69
56
|
'@eslint-react/jsx-shorthand-boolean': 'error',
|
|
70
57
|
'@eslint-react/jsx-shorthand-fragment': 'error',
|
|
@@ -20,6 +20,7 @@ import vendorRulesImports from "./vendor-rules/imports.js";
|
|
|
20
20
|
import vendorRulesStrict from "./vendor-rules/strict.js";
|
|
21
21
|
import vendorRulesTypescriptDisablings from "./vendor-rules/typescript-disablings.js";
|
|
22
22
|
import vendorRulesTypescript from "./vendor-rules/typescript.js";
|
|
23
|
+
import { convertWarnsToErrorsIfNeeded } from "./utils/convertWarnsToErrorsIfNeeded.js";
|
|
23
24
|
const NO_MIDDLE_ABBRS = '(?!.*[A-Z]{3})';
|
|
24
25
|
const NO_END_ABBRS = '(?!.*[A-Z]{2}$)';
|
|
25
26
|
const NO_MIDDLE_UNDERSCORE = '(?!.*_{2})';
|
|
@@ -38,14 +39,14 @@ const config = [
|
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
name: '@eslint/js/recommended',
|
|
41
|
-
...pluginJs.configs.recommended,
|
|
42
|
+
...convertWarnsToErrorsIfNeeded(pluginJs.configs.recommended),
|
|
42
43
|
},
|
|
43
|
-
...tsEslint.configs.strictTypeChecked,
|
|
44
|
-
...tsEslint.configs.stylisticTypeChecked,
|
|
45
|
-
eslintPluginImportX.flatConfigs.recommended,
|
|
46
|
-
eslintPluginImportX.flatConfigs.typescript,
|
|
47
|
-
eslintCommentsPlugin.recommended,
|
|
48
|
-
eslintPluginDeMorgan.configs.recommended,
|
|
44
|
+
...convertWarnsToErrorsIfNeeded(tsEslint.configs.strictTypeChecked),
|
|
45
|
+
...convertWarnsToErrorsIfNeeded(tsEslint.configs.stylisticTypeChecked),
|
|
46
|
+
convertWarnsToErrorsIfNeeded(eslintPluginImportX.flatConfigs.recommended),
|
|
47
|
+
convertWarnsToErrorsIfNeeded(eslintPluginImportX.flatConfigs.typescript),
|
|
48
|
+
convertWarnsToErrorsIfNeeded(eslintCommentsPlugin.recommended),
|
|
49
|
+
convertWarnsToErrorsIfNeeded(eslintPluginDeMorgan.configs.recommended),
|
|
49
50
|
{
|
|
50
51
|
name: '@dartess/recommended',
|
|
51
52
|
plugins: {
|
|
@@ -84,7 +85,7 @@ const config = [
|
|
|
84
85
|
],
|
|
85
86
|
'unicorn/no-useless-undefined': 'error',
|
|
86
87
|
'unicorn/prefer-node-protocol': 'error',
|
|
87
|
-
'@dartess/max-parent-
|
|
88
|
+
'@dartess/imports-max-parent-depth': 'error',
|
|
88
89
|
'import-x/order': [
|
|
89
90
|
'error',
|
|
90
91
|
{
|
|
@@ -227,7 +228,7 @@ const config = [
|
|
|
227
228
|
},
|
|
228
229
|
{
|
|
229
230
|
files: ['**/*.js', '**/*.mjs', '**/*.cjs', '**/*.jsx'],
|
|
230
|
-
...tsEslint.configs.disableTypeChecked,
|
|
231
|
+
...convertWarnsToErrorsIfNeeded(tsEslint.configs.disableTypeChecked),
|
|
231
232
|
},
|
|
232
233
|
{
|
|
233
234
|
name: '@dartess/recommended-js',
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import pluginStorybook from 'eslint-plugin-storybook';
|
|
2
|
+
import { convertWarnsToErrorsIfNeeded } from "./utils/convertWarnsToErrorsIfNeeded.js";
|
|
2
3
|
const config = [
|
|
3
4
|
{
|
|
4
5
|
ignores: ['!.storybook'],
|
|
5
6
|
},
|
|
6
|
-
...pluginStorybook.configs['flat/recommended'],
|
|
7
|
-
...pluginStorybook.configs['flat/csf-strict'],
|
|
7
|
+
...convertWarnsToErrorsIfNeeded(pluginStorybook.configs['flat/recommended']),
|
|
8
|
+
...convertWarnsToErrorsIfNeeded(pluginStorybook.configs['flat/csf-strict']),
|
|
8
9
|
{
|
|
9
10
|
name: '@dartess/storybook',
|
|
10
11
|
files: ['**/*.stories.tsx'],
|
|
@@ -13,7 +14,7 @@ const config = [
|
|
|
13
14
|
'@dartess/stories-export-meta': 'error', // TODO can be replaced with native storybook/meta-satisfies-type ?
|
|
14
15
|
'@dartess/stories-export-typed': 'error',
|
|
15
16
|
'@typescript-eslint/no-explicit-any': 'off', // can be hard for typing in stories
|
|
16
|
-
'@dartess/jsx-text-as-child': 'off', // not necessary in stories
|
|
17
|
+
'@dartess/jsx-no-text-as-child': 'off', // not necessary in stories
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare function convertWarnsToErrorsIfNeeded(configs: TSESLint.FlatConfig.Config): TSESLint.FlatConfig.Config;
|
|
3
|
+
declare function convertWarnsToErrorsIfNeeded(configs: TSESLint.FlatConfig.ConfigArray): TSESLint.FlatConfig.ConfigArray;
|
|
4
|
+
export { convertWarnsToErrorsIfNeeded };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const FORCE_ERRORS_INSTEAD_OF_WARNS = true;
|
|
2
|
+
function updateRuleLevel(ruleLevel) {
|
|
3
|
+
switch (ruleLevel) {
|
|
4
|
+
case 1:
|
|
5
|
+
return 2;
|
|
6
|
+
case 'warn':
|
|
7
|
+
return 'error';
|
|
8
|
+
default:
|
|
9
|
+
return ruleLevel;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function implementation(config) {
|
|
13
|
+
if (!config.rules) {
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
const rules = Object.fromEntries(Object.entries(config.rules).map(([ruleName, ruleEntry]) => {
|
|
17
|
+
if (ruleEntry === undefined) {
|
|
18
|
+
return [ruleName, ruleEntry];
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(ruleEntry)) {
|
|
21
|
+
const [ruleLevel, ...options] = ruleEntry;
|
|
22
|
+
return [ruleName, [updateRuleLevel(ruleLevel), ...options]];
|
|
23
|
+
}
|
|
24
|
+
return [ruleName, updateRuleLevel(ruleEntry)];
|
|
25
|
+
}));
|
|
26
|
+
return { ...config, rules };
|
|
27
|
+
}
|
|
28
|
+
function convertWarnsToErrorsIfNeeded(configs) {
|
|
29
|
+
if (!FORCE_ERRORS_INSTEAD_OF_WARNS) {
|
|
30
|
+
return configs;
|
|
31
|
+
}
|
|
32
|
+
return Array.isArray(configs)
|
|
33
|
+
? configs.map(config => implementation(config))
|
|
34
|
+
: implementation(configs);
|
|
35
|
+
}
|
|
36
|
+
export { convertWarnsToErrorsIfNeeded };
|
|
@@ -5,7 +5,6 @@ declare const rules: {
|
|
|
5
5
|
}];
|
|
6
6
|
'import-x/default': "off";
|
|
7
7
|
'import-x/namespace': "off";
|
|
8
|
-
'import-x/no-named-as-default': "error";
|
|
9
8
|
'import-x/no-extraneous-dependencies': ["error", {
|
|
10
9
|
devDependencies: string[];
|
|
11
10
|
optionalDependencies: boolean;
|
|
@@ -14,7 +13,6 @@ declare const rules: {
|
|
|
14
13
|
'import-x/no-amd': "error";
|
|
15
14
|
'import-x/no-nodejs-modules': "error";
|
|
16
15
|
'import-x/first': "error";
|
|
17
|
-
'import-x/no-duplicates': "error";
|
|
18
16
|
'import-x/extensions': ["error", string, {
|
|
19
17
|
js: string;
|
|
20
18
|
mjs: string;
|
|
@@ -13,9 +13,6 @@ const rules = {
|
|
|
13
13
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md
|
|
14
14
|
'import-x/namespace': 'off',
|
|
15
15
|
// Helpful warnings:
|
|
16
|
-
// do not allow a default import name to match a named export
|
|
17
|
-
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
|
|
18
|
-
'import-x/no-named-as-default': 'error',
|
|
19
16
|
// Forbid the use of extraneous packages
|
|
20
17
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
21
18
|
// paths are treated both as absolute paths, and relative to process.cwd()
|
|
@@ -58,9 +55,6 @@ const rules = {
|
|
|
58
55
|
// disallow non-import statements appearing before import statements
|
|
59
56
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
|
|
60
57
|
'import-x/first': 'error',
|
|
61
|
-
// disallow duplicate imports
|
|
62
|
-
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
63
|
-
'import-x/no-duplicates': 'error',
|
|
64
58
|
// Ensure consistent use of file extension within the import path
|
|
65
59
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
|
66
60
|
'import-x/extensions': [
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const plugin:
|
|
1
|
+
import type { Linter } from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
declare const plugin: Linter.Plugin;
|
|
3
3
|
export default plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import packageJson from '../package.json' with { type: 'json' };
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import ruleJsxNoTextAsChild from "./rules/jsx-no-text-as-child.js";
|
|
3
|
+
import ruleJsxNoCrossContextClasses from "./rules/jsx-no-cross-context-classes.js";
|
|
4
4
|
import ruleStoriesExportMeta from "./rules/stories-export-meta.js";
|
|
5
5
|
import ruleStoriesExportTyped from "./rules/stories-export-typed.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import ruleMobxStrictObservableComponentsDeclaration from "./rules/mobx-strict-observable-components-declaration.js";
|
|
7
|
+
import ruleMobxRequireObserver from "./rules/mobx-require-observer.js";
|
|
8
|
+
import ruleImportsMaxParentDepth from "./rules/imports-max-parent-depth.js";
|
|
9
9
|
import ruleTsNamedTupleElements from "./rules/ts-named-tuple-elements.js";
|
|
10
10
|
import ruleMobxSyncAutorun from "./rules/mobx-sync-autorun.js";
|
|
11
11
|
import ruleMobxSyncAction from "./rules/mobx-sync-action.js";
|
|
@@ -16,16 +16,16 @@ const plugin = {
|
|
|
16
16
|
},
|
|
17
17
|
processors: {},
|
|
18
18
|
rules: {
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
19
|
+
'imports-max-parent-depth': ruleImportsMaxParentDepth,
|
|
20
|
+
'jsx-no-cross-context-classes': ruleJsxNoCrossContextClasses,
|
|
21
|
+
'jsx-no-text-as-child': ruleJsxNoTextAsChild,
|
|
22
|
+
'mobx-strict-observable-components-declaration': ruleMobxStrictObservableComponentsDeclaration,
|
|
23
|
+
'mobx-sync-action': ruleMobxSyncAction,
|
|
24
|
+
'mobx-sync-autorun': ruleMobxSyncAutorun,
|
|
25
|
+
'mobx-require-observer': ruleMobxRequireObserver,
|
|
22
26
|
'stories-export-typed': ruleStoriesExportTyped,
|
|
23
|
-
'
|
|
24
|
-
'require-observer': ruleRequireObserver,
|
|
25
|
-
'max-parent-import-depth': ruleMaxParentImportDepth,
|
|
27
|
+
'stories-export-meta': ruleStoriesExportMeta,
|
|
26
28
|
'ts-named-tuple-elements': ruleTsNamedTupleElements,
|
|
27
|
-
'mobx-sync-autorun': ruleMobxSyncAutorun,
|
|
28
|
-
'mobx-sync-action': ruleMobxSyncAction,
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
export default plugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
2
|
export default ESLintUtils.RuleCreator(() => '')({
|
|
3
|
-
name: '
|
|
3
|
+
name: 'jsx-no-cross-context-classes',
|
|
4
4
|
defaultOptions: [{}],
|
|
5
5
|
meta: {
|
|
6
6
|
type: 'suggestion',
|
|
@@ -5,7 +5,7 @@ import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
|
5
5
|
*/
|
|
6
6
|
import emojiRegex from 'emoji-regex';
|
|
7
7
|
export default ESLintUtils.RuleCreator(() => '')({
|
|
8
|
-
name: 'jsx-text-as-child',
|
|
8
|
+
name: 'jsx-no-text-as-child',
|
|
9
9
|
defaultOptions: [{}],
|
|
10
10
|
meta: {
|
|
11
11
|
type: 'problem',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
2
|
export default ESLintUtils.RuleCreator(() => '')({
|
|
3
|
-
name: 'strict-observable-components-declaration',
|
|
3
|
+
name: 'mobx-strict-observable-components-declaration',
|
|
4
4
|
defaultOptions: [{}],
|
|
5
5
|
meta: {
|
|
6
6
|
type: 'suggestion',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Disallow relative imports going up more than a specified number of parent directories (max-parent-
|
|
1
|
+
# Disallow relative imports going up more than a specified number of parent directories (imports-max-parent-depth)
|
|
2
2
|
|
|
3
3
|
This rule limits the number of parent directory (../) levels allowed in import and export statements to enforce a flatter and more maintainable project structure.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Prevent mixing of outer and inner classes to avoid dependency on style order (
|
|
1
|
+
# Prevent mixing of outer and inner classes to avoid dependency on style order (jsx-no-cross-context-classes)
|
|
2
2
|
|
|
3
3
|
Avoid mixing outer and inner classes on the same element. The import order of the style is not guaranteed,
|
|
4
4
|
so the order in which the style is applied is also not guaranteed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Wrapping components in `observer` must comply with the regulations (strict-observable-components-declaration)
|
|
1
|
+
# Wrapping components in `observer` must comply with the regulations (mobx-strict-observable-components-declaration)
|
|
2
2
|
|
|
3
3
|
For more convenient work and debugging, several factors must be agreed upon:
|
|
4
4
|
the component that is passed to the observer must have the same name as
|
|
@@ -44,7 +44,7 @@ const Component = observer(function Component() {})
|
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
47
|
-
"@dartess/strict-observable-components-declaration": ["error", {"ignoreObserverArg": ["forwardRef"]}]
|
|
47
|
+
"@dartess/mobx-strict-observable-components-declaration": ["error", {"ignoreObserverArg": ["forwardRef"]}]
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -52,6 +52,6 @@ const Component = observer(function Component() {})
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"@dartess/strict-observable-components-declaration": ["error", {"allowedHocs": ["someHocName"]}]
|
|
55
|
+
"@dartess/mobx-strict-observable-components-declaration": ["error", {"allowedHocs": ["someHocName"]}]
|
|
56
56
|
}
|
|
57
57
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Enforce synchronous autorun callback
|
|
1
|
+
# Enforce synchronous autorun callback (mobx-sync-autorun)
|
|
2
2
|
|
|
3
3
|
Mobx `autorun` function must accept only synchronous `effect` callback.
|
|
4
4
|
This follows from the rules from official documentation, https://mobx.js.org/reactions.html#rules #2:
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|