@ota-meshi/eslint-plugin 0.8.0 → 0.9.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.
@@ -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.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,7 +43,7 @@
43
43
  "eslint-plugin-jsonc": "^1.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",
46
+ "eslint-plugin-node-dependencies": "^0.5.0",
47
47
  "eslint-plugin-prettier": "^3.1.4",
48
48
  "eslint-plugin-regexp": "^1.0.0",
49
49
  "eslint-plugin-toml": "0.2.0",