@pumpn/eslint-config 11.2.0 → 12.0.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.
Files changed (68) hide show
  1. package/.ls-lint.yml +6 -0
  2. package/.tool-versions +1 -0
  3. package/.vscode/settings.json +7 -0
  4. package/config.js +91 -62
  5. package/deno.json +40 -0
  6. package/deno.lock +3152 -0
  7. package/eslint.config.js +13 -0
  8. package/import-map.json +26 -0
  9. package/jsdoc.json +51 -0
  10. package/package.json +24 -17
  11. package/plugins.js +40 -0
  12. package/rules/_exports.js +21 -0
  13. package/rules/eslint-comments/_exports.js +2 -0
  14. package/rules/eslint-comments/best-practices.js +10 -0
  15. package/rules/eslint-comments/stylistic-issues.js +12 -0
  16. package/rules/eslint-comments.js +12 -0
  17. package/rules/github.js +27 -0
  18. package/rules/import/_exports.js +4 -0
  19. package/rules/import/helpful-warnings.js +18 -0
  20. package/rules/import/module-systems.js +9 -0
  21. package/rules/import/static-analysis.js +71 -0
  22. package/rules/import/style-guide.js +86 -0
  23. package/rules/import.js +12 -0
  24. package/rules/jsdoc.js +255 -54
  25. package/rules/jsx-a11y.js +139 -0
  26. package/rules/layout-and-formatting.js +4 -260
  27. package/rules/no-secrets.js +18 -0
  28. package/rules/no-unsanitized.js +6 -0
  29. package/rules/perfectionist.js +267 -0
  30. package/rules/possible-problems.js +66 -15
  31. package/rules/promise.js +25 -0
  32. package/rules/react.js +105 -2
  33. package/rules/redos.js +15 -0
  34. package/rules/regexp/_exports.js +3 -0
  35. package/rules/regexp/best-practices.js +43 -0
  36. package/rules/regexp/possible-errors.js +26 -0
  37. package/rules/regexp/stylistic-issues.js +62 -0
  38. package/rules/regexp.js +12 -0
  39. package/rules/security.js +18 -0
  40. package/rules/sonarjs/_exports.js +2 -0
  41. package/rules/sonarjs/bug-detection.js +14 -0
  42. package/rules/sonarjs/code-smell-detection.js +37 -0
  43. package/rules/sonarjs.js +12 -0
  44. package/rules/stylistic/_common/_exports.js +3 -0
  45. package/rules/stylistic/_common/min-items-for-array-newline.js +3 -0
  46. package/rules/stylistic/_exports.js +13 -0
  47. package/rules/stylistic/brackets.js +79 -0
  48. package/rules/stylistic/commas.js +13 -0
  49. package/rules/stylistic/comments.js +23 -0
  50. package/rules/stylistic/disallow.js +31 -0
  51. package/rules/stylistic/indent.js +12 -0
  52. package/rules/stylistic/jsx.js +35 -0
  53. package/rules/stylistic/linebreaks.js +74 -0
  54. package/rules/stylistic/misc.js +32 -0
  55. package/rules/stylistic/operators.js +26 -0
  56. package/rules/stylistic/quotes.js +7 -0
  57. package/rules/stylistic/semis.js +14 -0
  58. package/rules/stylistic/spacing.js +53 -0
  59. package/rules/stylistic/types.js +7 -0
  60. package/rules/stylistic.js +12 -0
  61. package/rules/suggestions.js +152 -135
  62. package/rules/tailwindcss.js +11 -0
  63. package/rules/unicorn.js +200 -0
  64. package/rules.js +11 -14
  65. package/.np-config.cjs +0 -1
  66. package/addons/deno.js +0 -15
  67. package/addons.js +0 -1
  68. package/rules/imports.js +0 -135
package/.ls-lint.yml ADDED
@@ -0,0 +1,6 @@
1
+ ls:
2
+ .js: kebab-case
3
+
4
+ ignore:
5
+ - .git
6
+ - node_modules
package/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ nodejs 21.6.2
@@ -0,0 +1,7 @@
1
+ {
2
+ "deno.enable": true,
3
+ "deno.lint": false,
4
+ "deno.unstable": true,
5
+ "eslint.experimental.useFlatConfig": true,
6
+ "eslint.useESLintClass": true
7
+ }
package/config.js CHANGED
@@ -1,80 +1,66 @@
1
- import babelParser from "@babel/eslint-parser";
2
- import js from "@eslint/js";
3
- import eslintPluginImport from "eslint-plugin-import";
4
- import eslintPluginJsdoc from "eslint-plugin-jsdoc";
5
- import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
6
- import reactRecommended from "eslint-plugin-react/configs/recommended.js";
7
- import eslintPluginSortKeysPlus from "eslint-plugin-sort-keys-plus";
1
+ import process from "node:process";
2
+
8
3
  import globals from "globals";
9
4
 
5
+ import plugins from "./plugins.js";
10
6
  import rules from "./rules.js";
11
7
 
8
+ const cssFilesRefreshRate = 5_000;
9
+
12
10
  const convertedGlobals = Object.fromEntries(
13
11
  Object.entries({
14
- ...globals.node,
15
- ...globals.browser
12
+ ...globals.browser,
13
+ ...globals.builtin
16
14
  })
17
- .map(([global, isWritable]) => [global, isWritable ? "writable" : "readonly"])
15
+ .map(([global, isWritable]) => [
16
+ global,
17
+ isWritable
18
+ ? "writable"
19
+ : "readonly"
20
+ ])
18
21
  );
19
22
 
20
- export * from "./addons.js";
21
-
22
- export default [
23
- js.configs.recommended,
23
+ const config = [
24
24
  {
25
- files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
26
- ...reactRecommended,
27
- ...reactJsxRuntime
25
+ ignores: [
26
+ "_fresh/**",
27
+ "documentation/**",
28
+ "patches/**"
29
+ ]
28
30
  },
29
31
  {
30
32
  files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
31
33
  languageOptions: {
32
34
  ecmaVersion: "latest",
33
- sourceType: "module",
34
35
  globals: {
36
+ Deno: "readonly",
35
37
  ...convertedGlobals
36
38
  },
37
- parser: babelParser,
38
39
  parserOptions: {
39
- ecmaVersion: "latest",
40
- sourceType: "module",
41
- requireConfigFile: false,
42
40
  ecmaFeatures: {
43
41
  jsx: true
44
42
  },
45
- babelOptions: {
46
- babelrc: false,
47
- configFile: false,
48
- presets: [
49
- [
50
- "@babel/preset-react",
51
- {
52
- bugfixes: true,
53
- shippedProposals: true
54
- }
55
- ]
56
- ],
57
- plugins: ["@babel/plugin-proposal-export-default-from"]
58
- }
59
- }
43
+ ecmaVersion: "latest",
44
+ jsxPragma: null,
45
+ requireConfigFile: false,
46
+ sourceType: "module"
47
+ },
48
+ sourceType: "module"
60
49
  },
61
- plugins: {
62
- "sort-keys-plus": eslintPluginSortKeysPlus,
63
- jsdoc: eslintPluginJsdoc,
64
- import: eslintPluginImport
50
+ linterOptions: {
51
+ noInlineConfig: false,
52
+ reportUnusedDisableDirectives: "error"
65
53
  },
54
+ plugins,
55
+ rules,
66
56
  settings: {
67
- jsdoc: {
68
- ignorePrivate: true,
69
- mode: "permissive"
70
- },
57
+ formComponents: ["Form"],
71
58
  "import/core-modules": [],
72
59
  "import/extensions": [
73
60
  ".js",
74
61
  ".mjs",
75
62
  ".jsx"
76
63
  ],
77
- "import/ignore": ["node_modules", "\\.(coffee|scss|css|less|hbs|svg|json|cjs)$"],
78
64
  "import/parsers": {
79
65
  espree: [
80
66
  ".js",
@@ -84,38 +70,81 @@ export default [
84
70
  ]
85
71
  },
86
72
  "import/resolver": {
73
+ "@jsenv/importmap-eslint-resolver": {
74
+ importMapFileRelativeUrl: "./import-map.json",
75
+ projectDirectoryUrl: process.cwd()
76
+ },
87
77
  node: true
88
78
  },
89
- react: {
90
- version: "detect"
79
+ jsdoc: {
80
+ mode: "typescript",
81
+ tagNamePreference: {
82
+ augments: "extends",
83
+ extends: "extends",
84
+ function: "method",
85
+ method: "method"
86
+ }
91
87
  },
92
- formComponents: ["Form"],
93
88
  linkComponents: [
94
89
  {
95
- name: "Link",
96
- linkAttribute: "to"
90
+ linkAttribute: "to",
91
+ name: "Link"
97
92
  }
98
- ]
99
- },
100
- rules
93
+ ],
94
+ react: {
95
+ pragma: "h",
96
+ version: "18"
97
+ },
98
+ regexp: {
99
+ allowedCharacterRanges: ["alphanumeric"]
100
+ },
101
+ tailwindcss: {
102
+ callees: [
103
+ "classnames",
104
+ "clsx",
105
+ "ctl"
106
+ ],
107
+ classRegex: "^class(Name)?$",
108
+ config: "tailwind.config.js",
109
+ cssFiles: [
110
+ "**/*.css",
111
+ "!**/node_modules",
112
+ "!**/.*",
113
+ "!**/dist",
114
+ "!**/build"
115
+ ],
116
+ cssFilesRefreshRate,
117
+ removeDuplicates: true,
118
+ skipClassAttribute: false,
119
+ tags: [],
120
+ whitelist: []
121
+ }
122
+ }
101
123
  },
102
124
  {
103
- files: ["jsdoc-example.js"],
125
+ files: ["**/*.{jsx,mjsx,tsx,mtsx}"],
104
126
  rules: {
105
- "import/no-unused-modules": "off"
127
+ "jsdoc/require-param": ["warn", { unnamedRootBase: ["props"] }]
106
128
  }
107
129
  },
108
130
  {
109
- files: ["**/**.cjs"],
131
+ files: ["**/_exports.?(*.)js"],
110
132
  rules: {
111
- "import/no-commonjs": ["off"],
112
- "import/no-unused-modules": "off"
133
+ "import/max-dependencies": "off",
134
+ "import/prefer-default-export": "off"
113
135
  }
114
136
  },
115
137
  {
116
- languageOptions: {
117
- ecmaVersion: "latest",
118
- sourceType: "module"
138
+ files: [
139
+ "benchmarks/**/*",
140
+ "tests/**/*",
141
+ "scripts/**/*"
142
+ ],
143
+ rules: {
144
+ "import/no-unused-modules": "off",
145
+ "import/unambiguous": "off"
119
146
  }
120
147
  }
121
148
  ];
149
+
150
+ export default config;
package/deno.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "tasks": {
3
+ "lint": "deno run -A npm:eslint .",
4
+ "docs": "jsdoc --configure jsdoc.json"
5
+ },
6
+ "compilerOptions": {
7
+ "allowJs": true,
8
+ "allowUnreachableCode": false,
9
+ "allowUnusedLabels": false,
10
+ "alwaysStrict": true,
11
+ "checkJs": true,
12
+ "exactOptionalPropertyTypes": true,
13
+ "jsx": "react-jsx",
14
+ "jsxImportSource": "preact",
15
+ "noErrorTruncation": true,
16
+ "noFallthroughCasesInSwitch": false,
17
+ "noImplicitAny": true,
18
+ "noImplicitOverride": true,
19
+ "noImplicitReturns": true,
20
+ "noImplicitThis": true,
21
+ "noPropertyAccessFromIndexSignature": false,
22
+ "noUncheckedIndexedAccess": false,
23
+ "noUnusedLocals": false,
24
+ "noUnusedParameters": false,
25
+ "strict": true,
26
+ "lib": [
27
+ "dom",
28
+ "dom.iterable",
29
+ "dom.asynciterable",
30
+ "deno.ns",
31
+ "deno.unstable",
32
+ "esnext"
33
+ ]
34
+ },
35
+ "loader": "native",
36
+ "importMap": "./import-map.json",
37
+ "exclude": [
38
+ "**/_fresh/*"
39
+ ]
40
+ }