@azat-io/eslint-config 2.95.0 → 2.96.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.
@@ -1,11 +1,9 @@
1
1
  import jsxA11y from "eslint-plugin-jsx-a11y";
2
2
  function a11y(config) {
3
3
  if (!config.react && !config.qwik) return {};
4
- let files = ["**/*.jsx"];
5
- if (config.typescript) files.push("**/*.tsx");
6
4
  return {
7
5
  name: "azat-io/a11y/rules",
8
- files,
6
+ files: ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []],
9
7
  plugins: { "jsx-a11y": jsxA11y },
10
8
  rules: {
11
9
  "jsx-a11y/alt-text": "error",
@@ -7,24 +7,25 @@ import sonarjsPlugin from "eslint-plugin-sonarjs";
7
7
  import unicornPlugin from "eslint-plugin-unicorn";
8
8
  import regexpPlugin from "eslint-plugin-regexp";
9
9
  import jsdocPlugin from "eslint-plugin-jsdoc";
10
+ import slopPlugin from "eslint-plugin-slop";
10
11
  import globals from "globals";
11
12
  function core(config) {
12
- let files = [
13
- "**/*.js",
14
- "**/*.cjs",
15
- "**/*.mjs"
16
- ];
17
- if (config.typescript) files.push("**/*.ts", "**/*.cts", "**/*.mts");
18
- if (config.react || config.qwik) {
19
- files.push("**/*.jsx");
20
- if (config.typescript) files.push("**/*.tsx");
21
- }
22
- if (config.astro) files.push("**/*.astro");
23
- if (config.svelte) files.push("**/*.svelte");
24
- if (config.vue) files.push("**/*.vue");
25
13
  return {
26
14
  name: "azat-io/core/rules",
27
- files,
15
+ files: [
16
+ "**/*.js",
17
+ "**/*.cjs",
18
+ "**/*.mjs",
19
+ ...config.typescript ? [
20
+ "**/*.ts",
21
+ "**/*.cts",
22
+ "**/*.mts"
23
+ ] : [],
24
+ ...config.react || config.qwik ? ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []] : [],
25
+ ...config.astro ? ["**/*.astro"] : [],
26
+ ...config.svelte ? ["**/*.svelte"] : [],
27
+ ...config.vue ? ["**/*.vue"] : []
28
+ ],
28
29
  languageOptions: {
29
30
  globals: {
30
31
  ...globals.browser,
@@ -44,6 +45,7 @@ function core(config) {
44
45
  "prefer-let": preferLetPlugin,
45
46
  promise: promisePlugin,
46
47
  regexp: regexpPlugin,
48
+ slop: slopPlugin,
47
49
  sonarjs: sonarjsPlugin,
48
50
  unicorn: unicornPlugin
49
51
  },
@@ -404,6 +406,14 @@ function core(config) {
404
406
  "regexp/unicode-escape": "error",
405
407
  "regexp/unicode-property": "error",
406
408
  "regexp/use-ignore-case": "error",
409
+ "slop/max-comment-length": "error",
410
+ "slop/no-chained-type-assertions": "error",
411
+ "slop/no-em-dash": "error",
412
+ "slop/no-jargon": "error",
413
+ "slop/no-static-only-class": "error",
414
+ "slop/no-trivial-functions": "error",
415
+ "slop/no-trivial-type-aliases": "error",
416
+ "slop/prefer-jsdoc": "error",
407
417
  "sonarjs/arguments-order": "error",
408
418
  "sonarjs/array-callback-without-return": "error",
409
419
  "sonarjs/for-in": "error",
@@ -542,6 +552,8 @@ function core(config) {
542
552
  "unicorn/no-unsafe-dom-html": "error",
543
553
  "unicorn/no-unsafe-promise-all-settled-values": "error",
544
554
  "unicorn/no-unused-array-method-return": "error",
555
+ "unicorn/no-unused-builtin-method-return": "error",
556
+ "unicorn/no-unused-iterator-helper": "error",
545
557
  "unicorn/no-unused-properties": "error",
546
558
  "unicorn/no-useless-boolean-cast": "error",
547
559
  "unicorn/no-useless-coercion": "error",
@@ -557,6 +569,7 @@ function core(config) {
557
569
  "unicorn/no-useless-promise-resolve-reject": "error",
558
570
  "unicorn/no-useless-re-export": "error",
559
571
  "unicorn/no-useless-recursion": "error",
572
+ "unicorn/no-useless-set-construction": "error",
560
573
  "unicorn/no-useless-spread": "error",
561
574
  "unicorn/no-useless-switch-case": "error",
562
575
  "unicorn/no-useless-template-literals": "error",
@@ -587,6 +600,7 @@ function core(config) {
587
600
  "unicorn/prefer-boolean-return": "error",
588
601
  "unicorn/prefer-class-fields": "error",
589
602
  "unicorn/prefer-classlist-toggle": "error",
603
+ "unicorn/prefer-combined-guards": "error",
590
604
  "unicorn/prefer-date-now": "error",
591
605
  "unicorn/prefer-default-parameters": "error",
592
606
  "unicorn/prefer-direct-iteration": "error",
@@ -608,6 +622,7 @@ function core(config) {
608
622
  "unicorn/prefer-iterable-in-constructor": "error",
609
623
  "unicorn/prefer-iterator-helpers": "error",
610
624
  "unicorn/prefer-iterator-to-array": "error",
625
+ "unicorn/prefer-json-import": "error",
611
626
  "unicorn/prefer-keyboard-event-key": "error",
612
627
  "unicorn/prefer-location-assign": "error",
613
628
  "unicorn/prefer-logical-operator-over-ternary": "error",
@@ -2,22 +2,22 @@ import { interopDefault } from "../utilities.js";
2
2
  async function node(config) {
3
3
  if (!config.node) return {};
4
4
  let nodePlugin = await interopDefault(import("eslint-plugin-n"));
5
- let files = [
6
- "**/*.js",
7
- "**/*.cjs",
8
- "**/*.mjs"
9
- ];
10
- if (config.typescript) files.push("**/*.ts", "**/*.cts", "**/*.mts");
11
- if (config.react || config.qwik) {
12
- files.push("**/*.jsx");
13
- if (config.typescript) files.push("**/*.tsx");
14
- }
15
- if (config.astro) files.push("**/*.astro");
16
- if (config.svelte) files.push("**/*.svelte");
17
- if (config.vue) files.push("**/*.vue");
18
5
  return {
19
6
  name: "azat-io/node/rules",
20
- files,
7
+ files: [
8
+ "**/*.js",
9
+ "**/*.cjs",
10
+ "**/*.mjs",
11
+ ...config.typescript ? [
12
+ "**/*.ts",
13
+ "**/*.cts",
14
+ "**/*.mts"
15
+ ] : [],
16
+ ...config.react || config.qwik ? ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []] : [],
17
+ ...config.astro ? ["**/*.astro"] : [],
18
+ ...config.svelte ? ["**/*.svelte"] : [],
19
+ ...config.vue ? ["**/*.vue"] : []
20
+ ],
21
21
  plugins: { node: nodePlugin },
22
22
  rules: {
23
23
  "node/handle-callback-err": ["error", "error"],
@@ -2,22 +2,22 @@ import { interopDefault } from "../utilities.js";
2
2
  async function perfectionist(config) {
3
3
  if (!config.perfectionist) return {};
4
4
  let perfectionistPlugin = await interopDefault(import("eslint-plugin-perfectionist"));
5
- let files = [
6
- "**/*.js",
7
- "**/*.cjs",
8
- "**/*.mjs"
9
- ];
10
- if (config.typescript) files.push("**/*.ts", "**/*.cts", "**/*.mts");
11
- if (config.react || config.qwik) {
12
- files.push("**/*.jsx");
13
- if (config.typescript) files.push("**/*.tsx");
14
- }
15
- if (config.astro) files.push("**/*.astro");
16
- if (config.svelte) files.push("**/*.svelte");
17
- if (config.vue) files.push("**/*.vue");
18
5
  return {
19
6
  name: "azat-io/perfectionist/rules",
20
- files,
7
+ files: [
8
+ "**/*.js",
9
+ "**/*.cjs",
10
+ "**/*.mjs",
11
+ ...config.typescript ? [
12
+ "**/*.ts",
13
+ "**/*.cts",
14
+ "**/*.mts"
15
+ ] : [],
16
+ ...config.react || config.qwik ? ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []] : [],
17
+ ...config.astro ? ["**/*.astro"] : [],
18
+ ...config.svelte ? ["**/*.svelte"] : [],
19
+ ...config.vue ? ["**/*.vue"] : []
20
+ ],
21
21
  plugins: { perfectionist: perfectionistPlugin },
22
22
  rules: {
23
23
  "perfectionist/sort-array-includes": ["error"],
@@ -2,11 +2,9 @@ import { interopDefault } from "../utilities.js";
2
2
  async function qwik(config) {
3
3
  if (!config.qwik) return {};
4
4
  let qwikPlugin = await interopDefault(import("eslint-plugin-qwik"));
5
- let files = ["**/*.jsx"];
6
- if (config.typescript) files.push("**/*.tsx");
7
5
  return {
8
6
  name: "azat-io/qwik/rules",
9
- files,
7
+ files: ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []],
10
8
  plugins: { qwik: qwikPlugin },
11
9
  rules: {
12
10
  "qwik/jsx-a": "error",
@@ -11,11 +11,9 @@ async function react(config) {
11
11
  interopDefault(import("eslint-plugin-react-web-api")),
12
12
  interopDefault(import("eslint-plugin-react-x"))
13
13
  ]);
14
- let files = ["**/*.jsx"];
15
- if (config.typescript) files.push("**/*.tsx");
16
14
  return {
17
15
  name: "azat-io/react/rules",
18
- files,
16
+ files: ["**/*.jsx", ...config.typescript ? ["**/*.tsx"] : []],
19
17
  plugins: {
20
18
  "react-compiler": reactCompilerPlugin,
21
19
  "react-dom": reactDomPlugin,
@@ -2,18 +2,17 @@ import { interopDefault } from "../utilities.js";
2
2
  async function typescript(config) {
3
3
  if (!config.typescript) return {};
4
4
  let { parser: typescriptParser, plugin: typescriptPlugin } = await interopDefault(import("typescript-eslint"));
5
- let files = [
6
- "**/*.ts",
7
- "**/*.cts",
8
- "**/*.mts"
9
- ];
10
- if (config.react || config.qwik) files.push("**/*.tsx");
11
- if (config.astro) files.push("**/*.astro");
12
- if (config.svelte) files.push("**/*.svelte");
13
- if (config.vue) files.push("**/*.vue");
14
5
  return {
15
6
  name: "azat-io/typescript/rules",
16
- files,
7
+ files: [
8
+ "**/*.ts",
9
+ "**/*.cts",
10
+ "**/*.mts",
11
+ ...config.react || config.qwik ? ["**/*.tsx"] : [],
12
+ ...config.astro ? ["**/*.astro"] : [],
13
+ ...config.svelte ? ["**/*.svelte"] : [],
14
+ ...config.vue ? ["**/*.vue"] : []
15
+ ],
17
16
  languageOptions: {
18
17
  parser: typescriptParser,
19
18
  parserOptions: {
@@ -2,22 +2,29 @@ import { interopDefault } from "../utilities.js";
2
2
  async function vitest(config) {
3
3
  if (!config.vitest) return {};
4
4
  let vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
5
- let files = [
6
- "**/test/*.js",
7
- "**/test/*.cjs",
8
- "**/test/*.mjs",
9
- "**/*.test.js",
10
- "**/*.test.cjs",
11
- "**/*.test.mjs"
12
- ];
13
- if (config.typescript) files.push("**/test/*.ts", "**/test/*.cts", "**/test/*.mts", "**/*.test.ts", "**/*.test.cts", "**/*.test.mts");
14
- if (config.react || config.qwik) {
15
- files.push("**/test/*.jsx", "**/*.test.jsx");
16
- if (config.typescript) files.push("**/test/*.tsx", "**/*.test.tsx");
17
- }
18
5
  return {
19
6
  name: "azat-io/vitest/rules",
20
- files,
7
+ files: [
8
+ "**/test/*.js",
9
+ "**/test/*.cjs",
10
+ "**/test/*.mjs",
11
+ "**/*.test.js",
12
+ "**/*.test.cjs",
13
+ "**/*.test.mjs",
14
+ ...config.typescript ? [
15
+ "**/test/*.ts",
16
+ "**/test/*.cts",
17
+ "**/test/*.mts",
18
+ "**/*.test.ts",
19
+ "**/*.test.cts",
20
+ "**/*.test.mts"
21
+ ] : [],
22
+ ...config.react || config.qwik ? [
23
+ "**/test/*.jsx",
24
+ "**/*.test.jsx",
25
+ ...config.typescript ? ["**/test/*.tsx", "**/*.test.tsx"] : []
26
+ ] : []
27
+ ],
21
28
  plugins: { vitest: vitestPlugin },
22
29
  rules: {
23
30
  "vitest/consistent-each-for": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azat-io/eslint-config",
3
- "version": "2.95.0",
3
+ "version": "2.96.0",
4
4
  "description": "ESLint shareable config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -27,7 +27,7 @@
27
27
  "./dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@eslint-community/eslint-plugin-eslint-comments": "^4.8.0",
30
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
31
31
  "@vitest/eslint-plugin": "1.6.27",
32
32
  "astro-eslint-parser": "^3.1.0",
33
33
  "eslint-config-flat-gitignore": "^2.4.0",
@@ -35,26 +35,27 @@
35
35
  "eslint-plugin-de-morgan": "^2.1.3",
36
36
  "eslint-plugin-depend": "^1.5.0",
37
37
  "eslint-plugin-import-lite": "^0.6.0",
38
- "eslint-plugin-jsdoc": "^64.3.6",
38
+ "eslint-plugin-jsdoc": "^64.5.0",
39
39
  "eslint-plugin-jsx-a11y": "^6.10.2",
40
40
  "eslint-plugin-n": "^18.3.0",
41
- "eslint-plugin-package-json": "^1.8.0",
42
- "eslint-plugin-perfectionist": "^5.11.0",
41
+ "eslint-plugin-package-json": "^1.8.1",
42
+ "eslint-plugin-perfectionist": "^5.11.1",
43
43
  "eslint-plugin-prefer-let": "^4.2.2",
44
44
  "eslint-plugin-promise": "^7.3.0",
45
45
  "eslint-plugin-qwik": "2.0.0-beta.21",
46
46
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
47
- "eslint-plugin-react-dom": "^5.19.0",
47
+ "eslint-plugin-react-dom": "^5.19.1",
48
48
  "eslint-plugin-react-hooks": "^7.1.1",
49
- "eslint-plugin-react-jsx": "^5.19.0",
50
- "eslint-plugin-react-naming-convention": "^5.19.0",
49
+ "eslint-plugin-react-jsx": "^5.19.1",
50
+ "eslint-plugin-react-naming-convention": "^5.19.1",
51
51
  "eslint-plugin-react-perf": "^3.3.3",
52
- "eslint-plugin-react-web-api": "^5.19.0",
53
- "eslint-plugin-react-x": "^5.19.0",
52
+ "eslint-plugin-react-web-api": "^5.19.1",
53
+ "eslint-plugin-react-x": "^5.19.1",
54
54
  "eslint-plugin-regexp": "^3.3.0",
55
- "eslint-plugin-sonarjs": "^4.2.0",
55
+ "eslint-plugin-slop": "^0.1.3",
56
+ "eslint-plugin-sonarjs": "^4.2.1",
56
57
  "eslint-plugin-svelte": "^3.23.0",
57
- "eslint-plugin-unicorn": "^74.0.0",
58
+ "eslint-plugin-unicorn": "^75.0.0",
58
59
  "eslint-plugin-vue": "^10.11.0",
59
60
  "globals": "^17.12.0",
60
61
  "jsonc-eslint-parser": "^3.3.0",
package/readme.md CHANGED
@@ -158,6 +158,7 @@ This config uses the following plugins:
158
158
  - [eslint-plugin-react-web-api](https://github.com/Rel1cx/eslint-react)
159
159
  - [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react)
160
160
  - [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
161
+ - [eslint-plugin-slop](https://github.com/antfu/eslint-plugin-slop)
161
162
  - [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/tree/master/packages/jsts/src/rules)
162
163
  - [eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte)
163
164
  - [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)