@dartess/eslint-plugin 0.0.8 → 0.1.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 CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  [//]: # (https://keepachangelog.com/en/1.1.0/)
4
4
 
5
+ ## [0.1.0] - 2026-01-02
6
+
7
+ - add `eslint-plugin-de-morgan` to `recommended` config
8
+
9
+ ## [0.0.9] - 2026-01-02
10
+
11
+ - remove overriding `@typescript-eslint/return-await` rule
12
+ - cleanup disabled rules
13
+ - add `prefer-object-has-own` to `recommended`: previously was disabled because of old browsers support
14
+ - apply `no-throw-literal` only for `js`-files (for `ts` files already enabled `@typescript-eslint/only-throw-error`)
15
+
5
16
  ## [0.0.8] - 2025-12-28
6
17
 
7
18
  - update `README`
package/README.md CHANGED
@@ -7,6 +7,7 @@ Also extends
7
7
  * `typescript-eslint` — `strictTypeChecked` & `stylisticTypeChecked`
8
8
  * `eslint-plugin-import-x` — `recommended` & `typescript`
9
9
  * `@eslint-community/eslint-plugin-eslint-comments` — `recommended`
10
+ * `eslint-plugin-de-morgan` — `recommended`
10
11
 
11
12
  Also can extends (if it is applicable)
12
13
  * `eslint-plugin-react` — `recommended` & `jsx-runtime`
@@ -32,7 +33,7 @@ All of it pinched with extra configs, setups and extra rules. Just take it and u
32
33
  You'll first need to install [ESLint](https://eslint.org/) and peer deps:
33
34
 
34
35
  ```sh
35
- npm i -D eslint eslint-plugin-import-x eslint-import-resolver-typescript @eslint-community/eslint-plugin-eslint-comments typescript-eslint eslint-plugin-unicorn eslint-plugin-decorator-position
36
+ npm i -D eslint eslint-plugin-import-x eslint-import-resolver-typescript @eslint-community/eslint-plugin-eslint-comments typescript-eslint eslint-plugin-unicorn eslint-plugin-decorator-position eslint-plugin-de-morgan
36
37
  ```
37
38
 
38
39
  Next, also install the packages that suit your needs.
@@ -127,8 +128,8 @@ Use `eslint-plugin-oxlint` for disabling unnecessary rules.
127
128
  #### Prettier (Old School)
128
129
 
129
130
  * Use `eslint-config-prettier` for disabling unnecessary rules.
130
- * Use `eslint-plugin-prettier` for running `prettier` as eslint rule.
131
- * 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).
131
+ * Or use `eslint-plugin-prettier` for running `prettier` as eslint rule.
132
+ * Or 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).
132
133
 
133
134
  ## Supported Rules
134
135
 
@@ -9,6 +9,7 @@ import pluginJs from '@eslint/js';
9
9
  import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs';
10
10
  // @ts-ignore: https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/778
11
11
  import eslintPluginDecoratorPosition from 'eslint-plugin-decorator-position';
12
+ import eslintPluginDeMorgan from 'eslint-plugin-de-morgan';
12
13
  import dartessPlugin from "../index.js";
13
14
  import vendorRulesBestPractices from "./vendor-rules/best-practices.js";
14
15
  import vendorRulesErrors from "./vendor-rules/errors.js";
@@ -44,12 +45,12 @@ const config = [
44
45
  eslintPluginImportX.flatConfigs.recommended,
45
46
  eslintPluginImportX.flatConfigs.typescript,
46
47
  eslintCommentsPlugin.recommended,
48
+ eslintPluginDeMorgan.configs.recommended,
47
49
  {
48
50
  name: '@dartess/recommended',
49
51
  plugins: {
50
52
  unicorn: eslintPluginUnicorn,
51
53
  '@dartess': dartessPlugin,
52
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/778
53
54
  'decorator-position': eslintPluginDecoratorPosition,
54
55
  },
55
56
  languageOptions: {
@@ -224,8 +225,16 @@ const config = [
224
225
  },
225
226
  },
226
227
  {
227
- files: ['**/*.js'],
228
+ files: ['**/*.js', '**/*.mjs', '**/*.cjs', '**/*.jsx'],
228
229
  ...tsEslint.configs.disableTypeChecked,
229
230
  },
231
+ {
232
+ name: '@dartess/recommended-js',
233
+ files: ['**/*.js', '**/*.mjs', '**/*.cjs', '**/*.jsx'],
234
+ rules: {
235
+ // enable for js files only
236
+ 'no-throw-literal': 'error',
237
+ },
238
+ },
230
239
  ];
231
240
  export default config;
@@ -87,19 +87,17 @@ declare const rules: {
87
87
  'no-script-url': "error";
88
88
  'no-self-compare': "error";
89
89
  'no-sequences': "error";
90
- 'no-throw-literal': "error";
91
90
  'no-useless-concat': "error";
92
91
  'no-useless-return': "error";
93
92
  'no-void': "error";
94
93
  'prefer-promise-reject-errors': ["error", {
95
94
  allowEmptyReject: boolean;
96
95
  }];
97
- 'prefer-object-has-own': "off";
96
+ 'prefer-object-has-own': "error";
98
97
  'prefer-regex-literals': ["error", {
99
98
  disallowRedundantWrapping: boolean;
100
99
  }];
101
100
  radix: "error";
102
- 'require-await': "off";
103
101
  'vars-on-top': "error";
104
102
  yoda: "error";
105
103
  };
@@ -171,9 +171,6 @@ const rules = {
171
171
  // disallow use of comma operator
172
172
  // https://eslint.org/docs/rules/no-sequences
173
173
  'no-sequences': 'error',
174
- // restrict what can be thrown as an exception
175
- // https://eslint.org/docs/rules/no-throw-literal
176
- 'no-throw-literal': 'error',
177
174
  // disallow useless string concatenation
178
175
  // https://eslint.org/docs/rules/no-useless-concat
179
176
  'no-useless-concat': 'error',
@@ -188,8 +185,7 @@ const rules = {
188
185
  'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
189
186
  // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
190
187
  // https://eslint.org/docs/rules/prefer-object-has-own
191
- // TODO: enable after browserslist Chrome 93+ and Safari 15.4+ and Firefox 92+
192
- 'prefer-object-has-own': 'off',
188
+ 'prefer-object-has-own': 'error',
193
189
  // https://eslint.org/docs/rules/prefer-regex-literals
194
190
  'prefer-regex-literals': [
195
191
  'error',
@@ -200,9 +196,6 @@ const rules = {
200
196
  // require use of the second argument for parseInt()
201
197
  // https://eslint.org/docs/rules/radix
202
198
  radix: 'error',
203
- // require `await` in `async function` (note: this is a horrible rule that should never be used)
204
- // https://eslint.org/docs/rules/require-await
205
- 'require-await': 'off',
206
199
  // requires to declare all vars on top of their containing scope
207
200
  // https://eslint.org/docs/rules/vars-on-top
208
201
  'vars-on-top': 'error',
@@ -2,17 +2,12 @@ declare const rules: {
2
2
  'no-restricted-exports': ["error", {
3
3
  restrictedNamedExports: string[];
4
4
  }];
5
- 'no-restricted-imports': ["off", {
6
- paths: never[];
7
- patterns: never[];
8
- }];
9
5
  'no-useless-computed-key': "error";
10
6
  'no-useless-rename': ["error", {
11
7
  ignoreDestructuring: boolean;
12
8
  ignoreImport: boolean;
13
9
  ignoreExport: boolean;
14
10
  }];
15
- 'no-var': "error";
16
11
  'object-shorthand': ["error", string, {
17
12
  ignoreConstructors: boolean;
18
13
  avoidQuotes: boolean;
@@ -14,15 +14,6 @@ const rules = {
14
14
  ],
15
15
  },
16
16
  ],
17
- // disallow specific imports
18
- // https://eslint.org/docs/rules/no-restricted-imports
19
- 'no-restricted-imports': [
20
- 'off',
21
- {
22
- paths: [],
23
- patterns: [],
24
- },
25
- ],
26
17
  // disallow useless computed property keys
27
18
  // https://eslint.org/docs/rules/no-useless-computed-key
28
19
  'no-useless-computed-key': 'error',
@@ -36,8 +27,6 @@ const rules = {
36
27
  ignoreExport: false,
37
28
  },
38
29
  ],
39
- // require let or const instead of var
40
- 'no-var': 'error',
41
30
  // require method and property shorthand syntax for object literals
42
31
  // https://eslint.org/docs/rules/object-shorthand
43
32
  'object-shorthand': [
@@ -152,9 +152,6 @@ declare const rules: {
152
152
  ignoreNonDOM: boolean;
153
153
  }];
154
154
  'jsx-a11y/aria-unsupported-elements': "error";
155
- 'jsx-a11y/autocomplete-valid': ["off", {
156
- inputComponents: never[];
157
- }];
158
155
  'jsx-a11y/click-events-have-key-events': "error";
159
156
  'jsx-a11y/heading-has-content': ["error", {
160
157
  components: string[];
@@ -16,6 +16,7 @@ const rules = {
16
16
  allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'],
17
17
  },
18
18
  ],
19
+ // TODO check it later
19
20
  // Prevent missing displayName in a React component definition
20
21
  // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
21
22
  'react/display-name': ['off', { ignoreTranspilerName: false }],
@@ -328,14 +329,6 @@ const rules = {
328
329
  // properties do not have those attributes.
329
330
  // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
330
331
  'jsx-a11y/aria-unsupported-elements': 'error',
331
- // Ensure the autocomplete attribute is correct and suitable for the form field it is used with
332
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md
333
- 'jsx-a11y/autocomplete-valid': [
334
- 'off',
335
- {
336
- inputComponents: [],
337
- },
338
- ],
339
332
  // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
340
333
  // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
341
334
  'jsx-a11y/click-events-have-key-events': 'error',
@@ -21,10 +21,7 @@ declare const rules: {
21
21
  classes: boolean;
22
22
  variables: boolean;
23
23
  }];
24
- 'require-await': "off";
25
24
  '@typescript-eslint/require-await': "off";
26
- 'no-return-await': "off";
27
- '@typescript-eslint/return-await': ["error", string];
28
25
  'import-x/extensions': ["error", string, {
29
26
  ts: string;
30
27
  tsx: string;
@@ -31,13 +31,9 @@ const rules = {
31
31
  'no-use-before-define': 'off',
32
32
  '@typescript-eslint/no-use-before-define': baseVariablesRules['no-use-before-define'],
33
33
  // Replace Airbnb 'require-await' rule with '@typescript-eslint' version
34
+ // require `await` in `async function` (note: this is a horrible rule that should never be used)
34
35
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
35
- 'require-await': 'off',
36
- '@typescript-eslint/require-await': baseBestPracticesRules['require-await'],
37
- // Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
38
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
39
- 'no-return-await': 'off',
40
- '@typescript-eslint/return-await': ['error', 'in-try-catch'],
36
+ '@typescript-eslint/require-await': 'off',
41
37
  // Append 'ts' and 'tsx' to Airbnb 'import-x/extensions' rule
42
38
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
43
39
  'import-x/extensions': [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dartess/eslint-plugin",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.1.0",
5
5
  "description": "A set of rules and configs for various TypeScript projects",
6
6
  "keywords": [
7
7
  "eslint",
@@ -50,6 +50,7 @@
50
50
  "@next/eslint-plugin-next": "^16.0.0",
51
51
  "eslint": "^9.0.0",
52
52
  "eslint-import-resolver-typescript": "^4.0.0",
53
+ "eslint-plugin-de-morgan": "^2.0.0",
53
54
  "eslint-plugin-decorator-position": "^6.0.0",
54
55
  "eslint-plugin-import-x": "^4.1.0",
55
56
  "eslint-plugin-jsx-a11y": "^6.10.0",