@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
@@ -0,0 +1,13 @@
1
+ import config from "./config.js";
2
+
3
+ const eslintConfig = [
4
+ ...config,
5
+ {
6
+ files: ["rules/unicorn.js"],
7
+ rules: {
8
+ "unicorn/string-content": "off"
9
+ }
10
+ }
11
+ ];
12
+
13
+ export default eslintConfig;
@@ -0,0 +1,26 @@
1
+ {
2
+ "imports": {
3
+ "@eslint-community/eslint-plugin-eslint-comments": "npm:@eslint-community/eslint-plugin-eslint-comments@^4.1.0",
4
+ "@jsenv/importmap-eslint-resolver": "npm:@jsenv/importmap-eslint-resolver@^5.2.5",
5
+ "@stylistic/eslint-plugin": "npm:@stylistic/eslint-plugin@^1.6.3",
6
+ "eslint-plugin-github": "npm:eslint-plugin-github@^4.10.2",
7
+ "eslint-plugin-import": "npm:eslint-plugin-import@^2.29.1",
8
+ "eslint-plugin-jsdoc": "npm:eslint-plugin-jsdoc@^48.2.1",
9
+ "eslint-plugin-jsx-a11y": "npm:eslint-plugin-jsx-a11y@^6.8.0",
10
+ "eslint-plugin-no-secrets": "npm:eslint-plugin-no-secrets@^0.8.9",
11
+ "eslint-plugin-no-unsanitized": "npm:eslint-plugin-no-unsanitized@^4.0.2",
12
+ "eslint-plugin-perfectionist": "npm:eslint-plugin-perfectionist@^2.6.0",
13
+ "eslint-plugin-promise": "npm:eslint-plugin-promise@^6.1.1",
14
+ "eslint-plugin-react": "npm:eslint-plugin-react@^7.34.0",
15
+ "eslint-plugin-redos": "npm:eslint-plugin-redos@^4.4.5",
16
+ "eslint-plugin-regexp": "npm:eslint-plugin-regexp@^2.2.0",
17
+ "eslint-plugin-security": "npm:eslint-plugin-security@^2.1.1",
18
+ "eslint-plugin-sonarjs": "npm:eslint-plugin-sonarjs@^0.24.0",
19
+ "eslint-plugin-tailwindcss": "npm:eslint-plugin-tailwindcss@^3.14.3",
20
+ "eslint-plugin-unicorn": "npm:eslint-plugin-unicorn@^51.0.1",
21
+ "globals": "https://esm.sh/globals@^14.0.0",
22
+ "preact": "https://esm.sh/*preact@10.19.3?dev",
23
+ "preact/jsx-runtime": "https://esm.sh/*preact@10.19.3/jsx-runtime?dev",
24
+ "radash": "npm:radash"
25
+ }
26
+ }
package/jsdoc.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "plugins": [
3
+ "plugins/markdown",
4
+ "node_modules/funbridge-jsdoc-template/typescript",
5
+ "node_modules/funbridge-jsdoc-template/category",
6
+ "node_modules/funbridge-jsdoc-template/component",
7
+ "node_modules/funbridge-jsdoc-template/typedef-import",
8
+ "node_modules/jsdoc-mermaid"
9
+ ],
10
+ "recurseDepth": 10,
11
+ "source": {
12
+ "include": [
13
+ "./"
14
+ ],
15
+ "includePattern": ".(?:j|t)sx?$",
16
+ "excludePattern": "(node_modules/|documentation/)"
17
+ },
18
+ "sourceType": "module",
19
+ "tags": {
20
+ "allowUnknownTags": true,
21
+ "dictionaries": [
22
+ "jsdoc",
23
+ "closure"
24
+ ]
25
+ },
26
+ "templates": {
27
+ "cleverLinks": false,
28
+ "monospaceLinks": false,
29
+ "search": true,
30
+ "default": {
31
+ "includeDate": false
32
+ }
33
+ },
34
+ "opts": {
35
+ "encoding": "utf8",
36
+ "destination": "./documentation/",
37
+ "template": "./node_modules/funbridge-jsdoc-template",
38
+ "recurse": true,
39
+ "verbose": false,
40
+ "theme_opts": {
41
+ "default_theme": "dark",
42
+ "seach": true,
43
+ "commonNav": true,
44
+ "typedefs": true
45
+ }
46
+ },
47
+ "markdown": {
48
+ "hardwrap": false,
49
+ "idInHeadings": true
50
+ }
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pumpn/eslint-config",
3
- "version": "11.2.0",
3
+ "version": "12.0.0",
4
4
  "description": "standard eslint config for pumpn code projects",
5
5
  "main": "config.js",
6
6
  "author": "Nano Miratus <nanomiratus@gmail.com>",
@@ -11,28 +11,35 @@
11
11
  "scripts": {
12
12
  "lint": "eslint .",
13
13
  "prepublishOnly": "npm run lint",
14
- "release": "np",
15
14
  "test": "echo 'no tests yet'"
16
15
  },
17
16
  "devDependencies": {
18
- "@pumpn/np-config": "^3.0.0",
19
- "eslint": "^8.40.0",
20
- "eslint-plugin-react": "*",
21
- "np": "^7.7.0"
17
+ "eslint": "^8.57.0",
18
+ "funbridge-jsdoc-template": "github:52-entertainment/funbridge-react-jsdoc",
19
+ "jsdoc-mermaid": "1.0.0"
22
20
  },
23
21
  "dependencies": {
24
- "@babel/eslint-parser": "^7.21.8",
25
- "@babel/plugin-proposal-export-default-from": "^7.18.10",
26
- "@babel/preset-react": "^7.18.6",
27
- "@eslint/js": "^8.40.0",
22
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
28
23
  "@jsenv/importmap-eslint-resolver": "^5.2.5",
29
- "globals": "^13.20.0"
24
+ "@stylistic/eslint-plugin": "^1.6.3",
25
+ "eslint-plugin-github": "^4.10.2",
26
+ "eslint-plugin-import": "^2.29.1",
27
+ "eslint-plugin-jsdoc": "^48.2.1",
28
+ "eslint-plugin-jsx-a11y": "^6.8.0",
29
+ "eslint-plugin-no-secrets": "^0.8.9",
30
+ "eslint-plugin-no-unsanitized": "^4.0.2",
31
+ "eslint-plugin-perfectionist": "^2.6.0",
32
+ "eslint-plugin-promise": "^6.1.1",
33
+ "eslint-plugin-react": "^7.34.0",
34
+ "eslint-plugin-redos": "^4.4.5",
35
+ "eslint-plugin-regexp": "^2.2.0",
36
+ "eslint-plugin-security": "^2.1.1",
37
+ "eslint-plugin-sonarjs": "^0.24.0",
38
+ "eslint-plugin-tailwindcss": "^3.14.3",
39
+ "eslint-plugin-unicorn": "^51.0.1",
40
+ "globals": "^14.0.0"
30
41
  },
31
42
  "peerDependencies": {
32
- "eslint": "^8.40.0",
33
- "eslint-plugin-import": "^2.27.5",
34
- "eslint-plugin-jsdoc": "^44.2.1",
35
- "eslint-plugin-react": "^7.32.2",
36
- "eslint-plugin-sort-keys-plus": "^1.3.1"
43
+ "eslint": "^8.57.0"
37
44
  }
38
- }
45
+ }
package/plugins.js ADDED
@@ -0,0 +1,40 @@
1
+ /* eslint-disable import/max-dependencies -- collection file */
2
+ import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
3
+ import stylistic from "@stylistic/eslint-plugin";
4
+ import github from "eslint-plugin-github";
5
+ import eslintPluginImport from "eslint-plugin-import";
6
+ import jsdoc from "eslint-plugin-jsdoc";
7
+ import jsxA11y from "eslint-plugin-jsx-a11y";
8
+ import noSecrets from "eslint-plugin-no-secrets";
9
+ import noUnsanitized from "eslint-plugin-no-unsanitized";
10
+ import perfectionist from "eslint-plugin-perfectionist";
11
+ import promise from "eslint-plugin-promise";
12
+ import react from "eslint-plugin-react";
13
+ import redos from "eslint-plugin-redos";
14
+ import regexp from "eslint-plugin-regexp";
15
+ import security from "eslint-plugin-security";
16
+ import sonarjs from "eslint-plugin-sonarjs";
17
+ import tailwindcss from "eslint-plugin-tailwindcss";
18
+ import unicorn from "eslint-plugin-unicorn";
19
+
20
+ const plugins = {
21
+ "@eslint-community/eslint-comments": eslintComments,
22
+ "@stylistic": stylistic,
23
+ github,
24
+ import: eslintPluginImport,
25
+ jsdoc,
26
+ "jsx-a11y": jsxA11y,
27
+ "no-secrets": noSecrets,
28
+ "no-unsanitized": noUnsanitized,
29
+ perfectionist,
30
+ promise,
31
+ react,
32
+ redos,
33
+ regexp,
34
+ security,
35
+ sonarjs,
36
+ tailwindcss,
37
+ unicorn
38
+ };
39
+
40
+ export default plugins;
@@ -0,0 +1,21 @@
1
+ export { default as eslintCommentsRules } from "./eslint-comments.js";
2
+ export { default as githubRules } from "./github.js";
3
+ export { default as importRules } from "./import.js";
4
+ export { default as jsdocRules } from "./jsdoc.js";
5
+ export { default as jsxA11yRules } from "./jsx-a11y.js";
6
+ export {
7
+ default as layoutAndFormattingRules
8
+ } from "./layout-and-formatting.js";
9
+ export { default as noSecretsRules } from "./no-secrets.js";
10
+ export { default as noUnsanitizedRules } from "./no-unsanitized.js";
11
+ export { default as perfectionistRules } from "./perfectionist.js";
12
+ export { default as possibleProblemsRules } from "./possible-problems.js";
13
+ export { default as reactRules } from "./react.js";
14
+ export { default as redosRules } from "./redos.js";
15
+ export { default as regexpRules } from "./regexp.js";
16
+ export { default as securityRules } from "./security.js";
17
+ export { default as sonarjsRules } from "./sonarjs.js";
18
+ export { default as stylisticRules } from "./stylistic.js";
19
+ export { default as suggestionsRules } from "./suggestions.js";
20
+ export { default as tailwindcssRules } from "./tailwindcss.js";
21
+ export { default as unicornRules } from "./unicorn.js";
@@ -0,0 +1,2 @@
1
+ export { default as bestPracticesRules } from "./best-practices.js";
2
+ export { default as stylisticIssuesRules } from "./stylistic-issues.js";
@@ -0,0 +1,10 @@
1
+ const bestPracticesRules = {
2
+ "@eslint-community/eslint-comments/disable-enable-pair": "off",
3
+ "@eslint-community/eslint-comments/no-aggregating-enable": "error",
4
+ "@eslint-community/eslint-comments/no-duplicate-disable": "error",
5
+ "@eslint-community/eslint-comments/no-unlimited-disable": "error",
6
+ "@eslint-community/eslint-comments/no-unused-disable": "error",
7
+ "@eslint-community/eslint-comments/no-unused-enable": "error"
8
+ };
9
+
10
+ export default bestPracticesRules;
@@ -0,0 +1,12 @@
1
+ const stylisticIssuesRules = {
2
+ "@eslint-community/eslint-comments/no-restricted-disable": ["error"],
3
+ "@eslint-community/eslint-comments/no-use": [
4
+ "error",
5
+ {
6
+ allow: ["eslint-disable"]
7
+ }
8
+ ],
9
+ "@eslint-community/eslint-comments/require-description": "error"
10
+ };
11
+
12
+ export default stylisticIssuesRules;
@@ -0,0 +1,12 @@
1
+ import * as eslintCommentsRuleSets from "./eslint-comments/_exports.js";
2
+
3
+ const eslintCommentsRules = Object.values(eslintCommentsRuleSets)
4
+ .reduce(
5
+ (allRules, ruleSet) => ({
6
+ ...allRules,
7
+ ...ruleSet
8
+ }),
9
+ {}
10
+ );
11
+
12
+ export default eslintCommentsRules;
@@ -0,0 +1,27 @@
1
+ const githubRules = {
2
+ "github/a11y-aria-label-is-well-formatted": "error",
3
+ "github/a11y-no-title-attribute": "error",
4
+ "github/a11y-no-visually-hidden-interactive-element": "error",
5
+ "github/a11y-role-supports-aria-props": "error",
6
+ "github/a11y-svg-has-accessible-name": "error",
7
+ "github/array-foreach": "error",
8
+ "github/async-currenttarget": "error",
9
+ "github/async-preventdefault": "error",
10
+ "github/authenticity-token": "error",
11
+ "github/get-attribute": "error",
12
+ "github/js-class-name": "error",
13
+ "github/no-blur": "error",
14
+ "github/no-d-none": "error",
15
+ "github/no-dataset": "error",
16
+ "github/no-dynamic-script-tag": "error",
17
+ "github/no-implicit-buggy-globals": "error",
18
+ "github/no-inner-html": "error",
19
+ "github/no-innerText": "error",
20
+ "github/no-then": "error",
21
+ "github/no-useless-passive": "error",
22
+ "github/prefer-observers": "error",
23
+ "github/require-passive-events": "error",
24
+ "github/unescaped-html-literal": "error"
25
+ };
26
+
27
+ export default githubRules;
@@ -0,0 +1,4 @@
1
+ export { default as helpfulWarningsRules } from "./helpful-warnings.js";
2
+ export { default as moduleSystemsRules } from "./module-systems.js";
3
+ export { default as staticAnalysisRules } from "./static-analysis.js";
4
+ export { default as styleGuideRules } from "./style-guide.js";
@@ -0,0 +1,18 @@
1
+ const helpfulWarningsRules = {
2
+ "import/export": "error",
3
+ "import/no-deprecated": "warn",
4
+ "import/no-empty-named-blocks": "error",
5
+ "import/no-extraneous-dependencies": "off",
6
+ "import/no-mutable-exports": "error",
7
+ "import/no-named-as-default": "error",
8
+ "import/no-named-as-default-member": "error",
9
+ "import/no-unused-modules": [
10
+ "error",
11
+ {
12
+ missingExports: true,
13
+ unusedExports: false
14
+ }
15
+ ]
16
+ };
17
+
18
+ export default helpfulWarningsRules;
@@ -0,0 +1,9 @@
1
+ const moduleSystemsRules = {
2
+ "import/no-amd": "error",
3
+ "import/no-commonjs": "error",
4
+ "import/no-import-module-exports": "error",
5
+ "import/no-nodejs-modules": "off",
6
+ "import/unambiguous": "error"
7
+ };
8
+
9
+ export default moduleSystemsRules;
@@ -0,0 +1,71 @@
1
+ const staticAnalysisRules = {
2
+ "import/default": "error",
3
+ "import/named": "error",
4
+ "import/namespace": "error",
5
+ "import/no-absolute-path": "error",
6
+ "import/no-cycle": [
7
+ "error",
8
+ {
9
+ maxDepth: Infinity
10
+ }
11
+ ],
12
+ "import/no-dynamic-require": "error",
13
+ "import/no-internal-modules": [
14
+ "off",
15
+ {
16
+ allow: []
17
+ }
18
+ ],
19
+ "import/no-relative-packages": "error",
20
+ "import/no-relative-parent-imports": "off",
21
+ "import/no-restricted-paths": [
22
+ "error",
23
+ {
24
+ zones: [
25
+ {
26
+ except: ["**/utilities/_exports.client.js"],
27
+ from: [
28
+ "plugins",
29
+ "routes",
30
+ "static",
31
+ "utilities"
32
+ ]
33
+ .map((folderName) => `./${folderName}/**/*`),
34
+ message: "Please use the utilities/_exports.client.js file to import server utilities",
35
+ target: "./islands/**/*"
36
+ },
37
+ {
38
+ except: ["**/utilities/_exports.server.js"],
39
+ from: [
40
+ "plugins",
41
+ "routes",
42
+ "static",
43
+ "utilities"
44
+ ]
45
+ .map((folderName) => `./${folderName}/**/*`),
46
+ message: "Please use the utilities/_exports.server.js file to import server utilities",
47
+ target: [
48
+ "./components/**/*",
49
+ "./logic/**/*",
50
+ "./patches/**/*",
51
+ "./plugins/**/*",
52
+ "./routes/**/*",
53
+ "./static/**/*"
54
+ ]
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "import/no-self-import": "error",
60
+ "import/no-unresolved": "error",
61
+ "import/no-useless-path-segments": [
62
+ "error",
63
+ {
64
+ commonjs: false,
65
+ noUselessIndex: false
66
+ }
67
+ ],
68
+ "import/no-webpack-loader-syntax": "error"
69
+ };
70
+
71
+ export default staticAnalysisRules;
@@ -0,0 +1,86 @@
1
+ const maxDependencies = 10;
2
+
3
+ const styleGuideRules = {
4
+ "import/consistent-type-specifier-style": "error",
5
+ "import/dynamic-import-chunkname": "off",
6
+ "import/exports-last": "error",
7
+ "import/extensions": ["error", "ignorePackages"],
8
+ "import/first": "error",
9
+ "import/group-exports": "error",
10
+ "import/max-dependencies": [
11
+ "error",
12
+ {
13
+ max: maxDependencies
14
+ }
15
+ ],
16
+ "import/newline-after-import": "error",
17
+ "import/no-anonymous-default-export": [
18
+ "error",
19
+ {
20
+ allowAnonymousClass: false,
21
+ allowAnonymousFunction: false,
22
+ allowArray: false,
23
+ allowArrowFunction: false,
24
+ allowCallExpression: false,
25
+ allowLiteral: false,
26
+ allowNew: false,
27
+ allowObject: false
28
+ }
29
+ ],
30
+ "import/no-default-export": "off",
31
+ "import/no-duplicates": "error",
32
+ "import/no-named-default": "error",
33
+ "import/no-named-export": "off",
34
+ "import/no-namespace": [
35
+ "error",
36
+ {
37
+ ignore: ["{./**/,**/}_exports.?(*.)js"]
38
+ }
39
+ ],
40
+ "import/no-unassigned-import": "error",
41
+ "import/order": [
42
+ "off",
43
+ {
44
+ alphabetize: {
45
+ caseInsensitive: false,
46
+ order: "asc"
47
+ },
48
+ groups: [
49
+ "type",
50
+ "object",
51
+ "builtin",
52
+ "external",
53
+ "internal",
54
+ "parent",
55
+ "sibling",
56
+ "index"
57
+ ],
58
+ "newlines-between": "always",
59
+ pathGroups: [
60
+ ...new Map([
61
+ ["builtin", ["std"]],
62
+ [
63
+ "internal",
64
+ [
65
+ "@/utilities",
66
+ "@/plugins",
67
+ "@/logic",
68
+ "@/components",
69
+ "@/islands"
70
+ ]
71
+ ]
72
+ ])
73
+ ]
74
+ .flatMap(([group, patterns]) => patterns
75
+ .map((pattern) => ({
76
+ group,
77
+ pattern: `${pattern}/**`,
78
+ position: "after"
79
+ }))),
80
+ warnOnUnassignedImports: false
81
+ }
82
+ ],
83
+ "import/prefer-default-export": ["error", { target: "single" }]
84
+ };
85
+
86
+ export default styleGuideRules;
@@ -0,0 +1,12 @@
1
+ import * as importRuleSets from "./import/_exports.js";
2
+
3
+ const importRules = Object.values(importRuleSets)
4
+ .reduce(
5
+ (allRules, ruleSet) => ({
6
+ ...allRules,
7
+ ...ruleSet
8
+ }),
9
+ {}
10
+ );
11
+
12
+ export default importRules;