@ota-meshi/eslint-plugin 0.8.0 → 0.10.1

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.
@@ -6,13 +6,13 @@ module.exports = require("../utils/module").requireOf(
6
6
  ["eslint-plugin-eslint-plugin"],
7
7
  () => ({
8
8
  plugins: ["eslint-plugin"],
9
- extends: [
10
- require.resolve("./+node"),
11
- "plugin:eslint-plugin/recommended",
12
- ],
13
9
  overrides: [
14
10
  {
15
11
  files: ["**/rules/**", "**/internal-rules/**"],
12
+ extends: [
13
+ require.resolve("./+node"),
14
+ "plugin:eslint-plugin/recommended",
15
+ ],
16
16
  rules: {
17
17
  "eslint-plugin/consistent-output": "error",
18
18
  "eslint-plugin/meta-property-ordering": [
@@ -16,4 +16,5 @@ module.exports = require("../utils/module").requireOf(
16
16
  },
17
17
  ],
18
18
  }),
19
+ { files: ["*.json", "*.json5"] },
19
20
  )
@@ -14,4 +14,5 @@ module.exports = require("../utils/module").requireOf(
14
14
  },
15
15
  ],
16
16
  }),
17
+ { files: ["*.md"] },
17
18
  )
@@ -26,4 +26,5 @@ module.exports = require("../utils/module").requireOf(
26
26
  },
27
27
  ],
28
28
  }),
29
+ { files: ["*.js"] },
29
30
  )
@@ -13,4 +13,5 @@ module.exports = require("../utils/module").requireOf(
13
13
  },
14
14
  ],
15
15
  }),
16
+ { files: ["package.json"] },
16
17
  )
@@ -1,12 +1,16 @@
1
1
  "use strict"
2
2
 
3
- module.exports = require("../utils/module").requireOf([], () => ({
4
- extends: ["plugin:toml/standard"],
5
- rules: {},
6
- overrides: [
7
- {
8
- files: ["*.toml"],
9
- extends: [require.resolve("./json-schema/config")],
10
- },
11
- ],
12
- }))
3
+ module.exports = require("../utils/module").requireOf(
4
+ [],
5
+ () => ({
6
+ extends: ["plugin:toml/standard"],
7
+ rules: {},
8
+ overrides: [
9
+ {
10
+ files: ["*.toml"],
11
+ extends: [require.resolve("./json-schema/config")],
12
+ },
13
+ ],
14
+ }),
15
+ { files: ["*.toml"] },
16
+ )
@@ -143,12 +143,10 @@ module.exports = require("../utils/module").requireOf(
143
143
  },
144
144
  ],
145
145
  }),
146
- () => ({
147
- overrides: [
148
- {
149
- files: ["*.ts"],
150
- processor: "@ota-meshi/missing-parser",
151
- },
152
- ],
153
- }),
146
+ {
147
+ files: ["*.ts"],
148
+ fallback: () => ({
149
+ processor: "@ota-meshi/missing-parser",
150
+ }),
151
+ },
154
152
  )
@@ -20,12 +20,10 @@ module.exports = require("../utils/module").requireOf(
20
20
  },
21
21
  ],
22
22
  }),
23
- () => ({
24
- overrides: [
25
- {
26
- files: ["*.vue"],
27
- processor: "@ota-meshi/missing-parser",
28
- },
29
- ],
30
- }),
23
+ {
24
+ files: ["*.vue"],
25
+ fallback: () => ({
26
+ processor: "@ota-meshi/missing-parser",
27
+ }),
28
+ },
31
29
  )
@@ -20,12 +20,10 @@ module.exports = require("../utils/module").requireOf(
20
20
  },
21
21
  ],
22
22
  }),
23
- () => ({
24
- overrides: [
25
- {
26
- files: ["*.vue"],
27
- processor: "@ota-meshi/missing-parser",
28
- },
29
- ],
30
- }),
23
+ {
24
+ files: ["*.vue"],
25
+ fallback: () => ({
26
+ processor: "@ota-meshi/missing-parser",
27
+ }),
28
+ },
31
29
  )
@@ -16,4 +16,10 @@ module.exports = require("../utils/module").requireOf(
16
16
  },
17
17
  ],
18
18
  }),
19
+ {
20
+ files: ["*.yaml", "*.yml"],
21
+ fallback: () => ({
22
+ processor: "@ota-meshi/missing-parser",
23
+ }),
24
+ },
19
25
  )
@@ -33,16 +33,44 @@ function has(name) {
33
33
  /**
34
34
  * Checks exists module and return config
35
35
  */
36
- function requireOf(names, getConfig, getFallback) {
36
+ function requireOf(names, getConfig, fallback) {
37
37
  let missings = names.filter((n) => !has(n))
38
38
 
39
39
  if (missings.length) {
40
+ const fb =
41
+ (typeof fallback === "function"
42
+ ? {
43
+ fallback,
44
+ }
45
+ : fallback) || {}
46
+ if (fb.fallback) {
47
+ Object.assign(fb, fb.fallback())
48
+ delete fb.fallback
49
+ }
50
+
51
+ // getFallback, files
52
+ if (fb.files && fb.files.length) {
53
+ return {
54
+ overrides: [
55
+ {
56
+ plugins: ["@ota-meshi"],
57
+ rules: {
58
+ "@ota-meshi/missing-module-for-config": [
59
+ "error",
60
+ missings,
61
+ ],
62
+ },
63
+ ...fb,
64
+ },
65
+ ],
66
+ }
67
+ }
40
68
  return {
41
69
  plugins: ["@ota-meshi"],
42
70
  rules: {
43
71
  "@ota-meshi/missing-module-for-config": ["error", missings],
44
72
  },
45
- ...(getFallback ? getFallback() : {}),
73
+ ...fb,
46
74
  }
47
75
  }
48
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ota-meshi/eslint-plugin",
3
- "version": "0.8.0",
3
+ "version": "0.10.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,27 +28,27 @@
28
28
  },
29
29
  "homepage": "https://github.com/ota-meshi/eslint-plugin#readme",
30
30
  "peerDependencies": {
31
- "eslint": "^7.0.0",
31
+ "eslint": "^7.0.0 || ^8.0.0",
32
32
  "eslint-plugin-regexp": "^1.0.0",
33
33
  "eslint-plugin-eslint-comments": "^3.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@typescript-eslint/eslint-plugin": "^4.0.0",
37
- "@typescript-eslint/parser": "^4.0.0",
38
- "eslint": "^7.7.0",
36
+ "@typescript-eslint/eslint-plugin": "^5.0.0-0",
37
+ "@typescript-eslint/parser": "^5.0.0-0",
38
+ "eslint": "^8.0.0",
39
39
  "eslint-config-prettier": "^8.0.0",
40
40
  "eslint-plugin-eslint-comments": "^3.2.0",
41
- "eslint-plugin-eslint-plugin": "^3.0.0",
42
- "eslint-plugin-json-schema-validator": "^1.0.0",
43
- "eslint-plugin-jsonc": "^1.0.0",
41
+ "eslint-plugin-eslint-plugin": "^4.0.0",
42
+ "eslint-plugin-json-schema-validator": "^2.0.0",
43
+ "eslint-plugin-jsonc": "^2.0.0",
44
44
  "eslint-plugin-markdown": "^2.0.0",
45
45
  "eslint-plugin-node": "^11.1.0",
46
- "eslint-plugin-node-dependencies": "^0.2.3",
47
- "eslint-plugin-prettier": "^3.1.4",
46
+ "eslint-plugin-node-dependencies": "^0.8.0",
47
+ "eslint-plugin-prettier": "^4.0.0",
48
48
  "eslint-plugin-regexp": "^1.0.0",
49
- "eslint-plugin-toml": "0.2.0",
50
- "eslint-plugin-vue": "^7.0.0-0",
51
- "eslint-plugin-yml": "^0.10.0",
49
+ "eslint-plugin-toml": "0.3.0",
50
+ "eslint-plugin-vue": "^8.0.0",
51
+ "eslint-plugin-yml": "^0.14.0",
52
52
  "mocha": "^9.0.0",
53
53
  "prettier": "^2.0.5",
54
54
  "typescript": "^4.1.5"