@dartess/eslint-plugin 0.6.0 → 0.7.1
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 +11 -0
- package/README.md +17 -17
- package/dist/configs/mobx.js +3 -3
- package/dist/configs/recommended.js +1 -1
- package/dist/configs/storybook.js +1 -1
- 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,17 @@
|
|
|
2
2
|
|
|
3
3
|
[//]: # (https://keepachangelog.com/en/1.1.0/)
|
|
4
4
|
|
|
5
|
+
## [0.7.1] - 2026-01-18
|
|
6
|
+
- rename some rules for more clear naming and consistency:
|
|
7
|
+
|
|
8
|
+
* `jsx-text-as-child` -> `jsx-no-text-as-child`
|
|
9
|
+
* `prevent-mixing-external-and-internal-classes` -> `jsx-no-cross-context-classes`
|
|
10
|
+
* `max-parent-import-depth` -> `imports-max-parent-depth`
|
|
11
|
+
* `strict-observable-components-declaration` -> `mobx-strict-observable-components-declaration`
|
|
12
|
+
* `require-observer` -> `mobx-require-observer`
|
|
13
|
+
|
|
14
|
+
Please, rename rules in your config, if you're using them directly
|
|
15
|
+
|
|
5
16
|
## [0.6.0] - 2026-01-17
|
|
6
17
|
- replace legacy `eslint-plugin-react` with modern `@eslint-react/eslint-plugin`
|
|
7
18
|
|
package/README.md
CHANGED
|
@@ -158,23 +158,23 @@ Each rule has emojis denoting:
|
|
|
158
158
|
- 🔧 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
159
|
- 💡 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
160
|
|
|
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)
|
|
161
|
+
| Name | Description | ✅ | 🔧 | 💡 |
|
|
162
|
+
|:-------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
|
|
163
|
+
| **imports** | _config: recommended_ | | | |
|
|
164
|
+
| [imports-max-parent-depth](docs/rules/imports-max-parent-depth.md) | Limit relative imports to a maximum parent depth. | ✅ | | |
|
|
165
|
+
| **TypeScript** | _config: recommended_ | | | |
|
|
166
|
+
| [ts-named-tuple-elements](docs/rules/ts-named-tuple-elements.md) | Enforce (or forbid) named tuple elements | ✅ | | |
|
|
167
|
+
| **React** | _config: react_ | | | |
|
|
168
|
+
| [jsx-no-text-as-child](docs/rules/jsx-no-text-as-child.md) | JSX elements should not have text without translation | | | |
|
|
169
|
+
| [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. | | | |
|
|
170
|
+
| **Storybook** | _config: storybook_ | | | |
|
|
171
|
+
| [stories-export-meta](docs/rules/stories-export-meta.md) | Storybook's Meta should be typed | ✅ | | |
|
|
172
|
+
| [stories-export-typed](docs/rules/stories-export-typed.md) | Storybook's Stories should be typed | ✅ | | |
|
|
173
|
+
| **MobX** | _config: mobx_ | | | |
|
|
174
|
+
| [mobx-strict-observable-components-declaration](docs/rules/mobx-strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | ✅ | | |
|
|
175
|
+
| [mobx-require-observer](docs/rules/mobx-require-observer.md) | Components using the stores must be wrapped in an `observer` | ✅ | 🔧 | |
|
|
176
|
+
| [mobx-sync-autorun](docs/rules/mobx-sync-autorun.md) | Enforce synchronous autorun callback | ✅ | | |
|
|
177
|
+
| [mobx-sync-action](docs/rules/mobx-sync-action.md) | Enforce synchronous actions | ✅ | | |
|
|
178
178
|
|
|
179
179
|
## Code Reuse Policy
|
|
180
180
|
|
package/dist/configs/mobx.js
CHANGED
|
@@ -4,10 +4,10 @@ const config = [
|
|
|
4
4
|
{
|
|
5
5
|
name: '@dartess/mobx',
|
|
6
6
|
rules: {
|
|
7
|
-
'mobx/missing-observer': 'off', // replaced by the neater "@dartess/require-observer"
|
|
7
|
+
'mobx/missing-observer': 'off', // replaced by the neater "@dartess/mobx-require-observer"
|
|
8
8
|
'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',
|
|
9
|
+
'@dartess/mobx-strict-observable-components-declaration': 'error',
|
|
10
|
+
'@dartess/mobx-require-observer': 'error',
|
|
11
11
|
'@dartess/mobx-sync-autorun': 'error', // TODO implement it by types?
|
|
12
12
|
'@dartess/mobx-sync-action': 'error', // TODO implement it by types?
|
|
13
13
|
},
|
|
@@ -13,7 +13,7 @@ const config = [
|
|
|
13
13
|
'@dartess/stories-export-meta': 'error', // TODO can be replaced with native storybook/meta-satisfies-type ?
|
|
14
14
|
'@dartess/stories-export-typed': 'error',
|
|
15
15
|
'@typescript-eslint/no-explicit-any': 'off', // can be hard for typing in stories
|
|
16
|
-
'@dartess/jsx-text-as-child': 'off', // not necessary in stories
|
|
16
|
+
'@dartess/jsx-no-text-as-child': 'off', // not necessary in stories
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
];
|
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
|