@dartess/eslint-plugin 0.0.3 → 0.0.4

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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  [//]: # (https://keepachangelog.com/en/1.1.0/)
4
4
 
5
+ ## [0.0.4] - 2025-12-27
6
+
7
+ - remove `arrow-body-style` from 'recommeded': not relevant for typed code
8
+ - add `@typescript-eslint/consistent-type-imports` to `recommeded`: it helps with three-shaking
9
+
5
10
  ## [0.0.3] - 2025-12-25
6
11
 
7
12
  - disable recommended `mobx/missing-make-observable`: this rule useless with modern decorators syntax
package/README.md CHANGED
@@ -1,10 +1,33 @@
1
1
  # @dartess/eslint-plugin
2
2
 
3
- A set of rules for various react projects
3
+ A set of configs and rules for various TypeScript projects.
4
+ Based on outdated or deprecated configs `eslint-config-airbnb` and `eslint-config-airbnb-typescript`.
5
+ Also extends
6
+ * `@eslint/js` — `recommended`
7
+ * `typescript-eslint` — `strictTypeChecked` & `stylisticTypeChecked`
8
+ * `eslint-plugin-import-x` — `recommended` & `typescript`
9
+ * `@eslint-community/eslint-plugin-eslint-comments` — `recommended`
10
+
11
+ Also can extends (if it is applicable)
12
+ * `eslint-plugin-react` — `recommended` & `jsx-runtime`
13
+ * `@next/eslint-plugin-next` — `recommended` & `core-web-vitals`
14
+ * `eslint-config-next`
15
+ * `eslint-plugin-mobx` — `recommended`
16
+ * `eslint-plugin-storybook` — `recommended` & `csf-strict`
17
+
18
+ All of it pinched with extra configs, setups and extra rules. Just take it and use it!
19
+
20
+ ### Notes
21
+
22
+ 1. The package is intended for use with TypeScript (it'll be useful for plain JS, but it hasn't been weel-tested).
23
+
24
+ 2. The package is intended for use only with the `flat` eslint config.
25
+
26
+ 3. _(for React users)_ The package is intended for use with [React New JSX Transform](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
4
27
 
5
28
  ## Installation
6
29
 
7
- You'll first need to install [ESLint](https://eslint.org/) and common peer deps:
30
+ You'll first need to install [ESLint](https://eslint.org/) and peer deps:
8
31
 
9
32
  ```sh
10
33
  npm i -D eslint eslint-plugin-import-x eslint-import-resolver-typescript @eslint-community/eslint-plugin-eslint-comments typescript-eslint eslint-plugin-unicorn
@@ -25,7 +48,7 @@ npm i -D eslint-plugin-mobx
25
48
  npm i -D eslint-plugin-storybook
26
49
  ```
27
50
 
28
- Next, install `@dartess/eslint-plugin`
51
+ Next, install `@dartess/eslint-plugin` itself.
29
52
 
30
53
  ```sh
31
54
  npm i -D @dartess/eslint-plugin
@@ -52,7 +75,7 @@ import dartessEslintPluginStorybook from '@dartess/eslint-plugin/storybook';
52
75
  import { parseGitIgnore } from '@dartess/eslint-plugin/utils';
53
76
 
54
77
  export default [
55
- parseGitIgnore(), // the easiest way to ignore all `.gitignore` files
78
+ parseGitIgnore(), // (optional) the easiest way to ignore all `.gitignore` files
56
79
 
57
80
  {
58
81
  languageOptions: {
@@ -75,45 +98,47 @@ export default [
75
98
 
76
99
  ```
77
100
 
78
- The package is intended for use with TypeScript.
79
-
80
- The package is intended for use with [React New JSX Transform](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
81
-
82
- The package is intended for use only with the `flat` eslint config.
83
-
84
101
  ## Next steps
85
102
 
86
- If you are using React, you also probably will want to add
103
+ If you're using React, you also probably will want to add
87
104
  [eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh).
88
105
  This plugin requires manual setup for you build tools.
89
106
 
90
- If you are using Mobx with legacy decorators, you have to enable rule `mobx/missing-make-observable` manually.
107
+ If you're using Mobx with legacy decorators, you have to enable rule `mobx/missing-make-observable` manually.
91
108
 
92
- ## Usage rules
109
+ ### Formatters
93
110
 
94
- Copy example above into your `eslint.config.ts` and remove unnecesary parts.
111
+ If you're want to (and you should to) use formatting tools, you need to additionally install and setup something else.
95
112
 
96
- Then configure the rules you want to use under the rules section.
113
+ #### dprint
97
114
 
98
- ```json
99
- {
100
- "rules": {
101
- "@dartess/strict-observable-components-declaration": "error"
102
- }
103
- }
104
- ```
115
+ Use `eslint-plugin-format` with rule `format/dprint` for running `dprint` as eslint rule (you probably will want to add `eslint-config-prettier` for disabling unnecessary rules).
116
+
117
+ #### Biome
118
+
119
+ Use `eslint-config-biome` for disabling unnecessary rules.
120
+
121
+ #### Oxlint
122
+
123
+ Use `eslint-plugin-oxlint` for disabling unnecessary rules.
124
+
125
+ #### Prettier (Old School)
126
+
127
+ * Use `eslint-config-prettier` for disabling unnecessary rules.
128
+ * Use `eslint-plugin-prettier` for running `prettier` as eslint rule.
129
+ * Use `eslint-plugin-format` with rule `format/prettier` for running `prettier` as eslint rule (you probably will want to add `eslint-config-prettier` for disabling unnecessary rules).
105
130
 
106
131
  ## Supported Rules
107
132
 
108
133
  Each rule has emojis denoting:
109
134
 
110
- - ✅ if it belongs to the `recommended` configuration
135
+ - ✅ if it belongs to the one of `recommended` configuration
111
136
  - 🔧 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
112
137
  - 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
113
138
 
114
139
  | Name | Description | ✅ | 🔧 | 💡 |
115
140
  |:-----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
116
- | [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | | | |
141
+ | [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. || | |
117
142
  | [require-observer](docs/rules/require-observer.md) | Components using the stores must be wrapped in an `observer` | ✅ | 🔧 | |
118
143
  | [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. | | | |
119
144
  | [jsx-no-text-as-child](docs/rules/jsx-text-as-child.md) | JSX elements should not have text without translation | | | |
@@ -19,7 +19,10 @@ const config = [
19
19
  },
20
20
  },
21
21
  },
22
- reactPlugin.configs.flat.recommended,
22
+ {
23
+ name: 'react/recommended', // missed name, @see e.g. https://github.com/jsx-eslint/eslint-plugin-react/pull/3882
24
+ ...reactPlugin.configs.flat.recommended,
25
+ },
23
26
  {
24
27
  name: '@dartess/eslint-plugin-react/jsx-runtime',
25
28
  files: ['**/*.{jsx,tsx}'],
@@ -199,8 +199,16 @@ const config = [
199
199
  allowNever: false,
200
200
  },
201
201
  ],
202
- '@typescript-eslint/no-import-type-side-effects': 'error', // TODO is enabled by default?
203
202
  '@typescript-eslint/array-type': ['error', { default: 'generic' }],
203
+ /* this two rules help with three-shaking */
204
+ '@typescript-eslint/no-import-type-side-effects': 'error',
205
+ '@typescript-eslint/consistent-type-imports': [
206
+ 'error',
207
+ {
208
+ fixStyle: 'inline-type-imports',
209
+ disallowTypeAnnotations: false,
210
+ },
211
+ ],
204
212
  },
205
213
  },
206
214
  {
@@ -1,7 +1,4 @@
1
1
  declare const rules: {
2
- 'arrow-body-style': ["error", string, {
3
- requireReturnForObjectLiteral: boolean;
4
- }];
5
2
  'no-class-assign': "error";
6
3
  'no-restricted-exports': ["error", {
7
4
  restrictedNamedExports: string[];
@@ -3,15 +3,6 @@
3
3
  // License: MIT (see LICENSE-eslint-config-airbnb.md file)
4
4
  // Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/es6.js
5
5
  const rules = {
6
- // enforces no braces where they can be omitted
7
- // https://eslint.org/docs/rules/arrow-body-style
8
- 'arrow-body-style': [
9
- 'error',
10
- 'as-needed',
11
- {
12
- requireReturnForObjectLiteral: false,
13
- },
14
- ],
15
6
  // disallow modifying variables of class declarations
16
7
  // https://eslint.org/docs/rules/no-class-assign
17
8
  'no-class-assign': 'error',
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { ESLint } from 'eslint';
1
+ import type { ESLint } from 'eslint';
2
2
  declare const plugin: ESLint.Plugin;
3
3
  export default plugin;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dartess/eslint-plugin",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "description": "A set of rules and configs for various react projects",
6
6
  "keywords": [
7
7
  "eslint",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "scripts": {
24
24
  "lint": "eslint .",
25
+ "lint:fix": "npm run lint -- --fix",
25
26
  "clean": "rimraf dist",
26
27
  "build": "npm run clean && tsc -p tsconfig.build.json",
27
28
  "test": "node --import ./test-setup.ts --test --experimental-strip-types",