@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.
Files changed (26) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +17 -17
  3. package/dist/configs/mobx.js +3 -3
  4. package/dist/configs/recommended.js +1 -1
  5. package/dist/configs/storybook.js +1 -1
  6. package/dist/index.js +13 -13
  7. package/dist/rules/{max-parent-import-depth.js → imports-max-parent-depth.js} +1 -1
  8. package/dist/rules/{prevent-mixing-external-and-internal-classes.js → jsx-no-cross-context-classes.js} +1 -1
  9. package/dist/rules/{jsx-text-as-child.js → jsx-no-text-as-child.js} +1 -1
  10. package/dist/rules/{require-observer.js → mobx-require-observer.js} +1 -1
  11. package/dist/rules/{strict-observable-components-declaration.js → mobx-strict-observable-components-declaration.js} +1 -1
  12. package/docs/rules/{max-parent-import-depth.md → imports-max-parent-depth.md} +1 -1
  13. package/docs/rules/{prevent-mixing-external-and-internal-classes.md → jsx-no-cross-context-classes.md} +1 -1
  14. package/docs/rules/{require-observer.md → mobx-require-observer.md} +1 -1
  15. package/docs/rules/{strict-observable-components-declaration.md → mobx-strict-observable-components-declaration.md} +3 -3
  16. package/docs/rules/mobx-sync-action.md +1 -1
  17. package/docs/rules/mobx-sync-autorun.md +1 -1
  18. package/docs/rules/stories-export-meta.md +1 -1
  19. package/docs/rules/stories-export-typed.md +1 -1
  20. package/package.json +1 -1
  21. /package/dist/rules/{max-parent-import-depth.d.ts → imports-max-parent-depth.d.ts} +0 -0
  22. /package/dist/rules/{prevent-mixing-external-and-internal-classes.d.ts → jsx-no-cross-context-classes.d.ts} +0 -0
  23. /package/dist/rules/{jsx-text-as-child.d.ts → jsx-no-text-as-child.d.ts} +0 -0
  24. /package/dist/rules/{require-observer.d.ts → mobx-require-observer.d.ts} +0 -0
  25. /package/dist/rules/{strict-observable-components-declaration.d.ts → mobx-strict-observable-components-declaration.d.ts} +0 -0
  26. /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 | Description | ✅ | 🔧 | 💡 |
162
- |:-----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
163
- | **imports** | _config: recommended_ | | | |
164
- | [max-parent-import-depth](docs/rules/max-parent-import-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-text-as-child.md) | JSX elements should not have text without translation | | | |
169
- | [prevent-mixing-external-and-internal-classes](docs/rules/prevent-mixing-external-and-internal-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
- | [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | ✅ | | |
175
- | [require-observer](docs/rules/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 | ✅ | | |
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
 
@@ -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
  },
@@ -84,7 +84,7 @@ const config = [
84
84
  ],
85
85
  'unicorn/no-useless-undefined': 'error',
86
86
  'unicorn/prefer-node-protocol': 'error',
87
- '@dartess/max-parent-import-depth': 'error',
87
+ '@dartess/imports-max-parent-depth': 'error',
88
88
  'import-x/order': [
89
89
  'error',
90
90
  {
@@ -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 ruleJsxTextAsChildFrom from "./rules/jsx-text-as-child.js";
3
- import rulePreventMixingExternalAndInternalClasses from "./rules/prevent-mixing-external-and-internal-classes.js";
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 ruleStrictObservableComponentsDeclaration from "./rules/strict-observable-components-declaration.js";
7
- import ruleRequireObserver from "./rules/require-observer.js";
8
- import ruleMaxParentImportDepth from "./rules/max-parent-import-depth.js";
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
- 'jsx-text-as-child': ruleJsxTextAsChildFrom,
20
- 'prevent-mixing-external-and-internal-classes': rulePreventMixingExternalAndInternalClasses,
21
- 'stories-export-meta': ruleStoriesExportMeta,
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
- 'strict-observable-components-declaration': ruleStrictObservableComponentsDeclaration,
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: 'max-parent-import-depth',
3
+ name: 'imports-max-parent-depth',
4
4
  defaultOptions: [],
5
5
  meta: {
6
6
  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: 'prevent-mixing-external-and-internal-classes',
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',
@@ -14,7 +14,7 @@ function isCustomHook(fn) {
14
14
  return false;
15
15
  }
16
16
  export default ESLintUtils.RuleCreator(() => '')({
17
- name: 'require-observer',
17
+ name: 'mobx-require-observer',
18
18
  meta: {
19
19
  type: 'problem',
20
20
  docs: {
@@ -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-import-depth)
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 (prevent-mixing-external-and-internal-classes)
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
- # Require wrap components in observer if needed (require-observer)
1
+ # Require wrap components in observer if needed (mobx-require-observer)
2
2
 
3
3
  This rule requires that React components using specified store hooks are wrapped in `observer()` from `mobx-react-lite`.
4
4
 
@@ -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 actions
1
+ # Enforce synchronous actions (mobx-sync-action)
2
2
 
3
3
  Mobx methods marked as `@action` must be synchronous: https://mobx.js.org/actions.html#asynchronous-actions
4
4
 
@@ -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:
@@ -1,4 +1,4 @@
1
- # Makes meta-information typing mandatory
1
+ # Makes meta-information typing mandatory (stories-export-meta)
2
2
 
3
3
  Storybook stories should contain meta information. Thanks to this rule, meta-information will always be typed.
4
4
 
@@ -1,4 +1,4 @@
1
- # Makes stories typing mandatory
1
+ # Makes stories typing mandatory (stories-export-typed)
2
2
 
3
3
  Forces typing of exported stories.
4
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dartess/eslint-plugin",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.7.1",
5
5
  "description": "A set of rules and configs for various TypeScript projects",
6
6
  "keywords": [
7
7
  "eslint",