Skip to content

Commit 4ecb8d2

Browse files
committed
Fix configuration, update generator
1 parent c9daf2d commit 4ecb8d2

File tree

5 files changed

+56
-49
lines changed

5 files changed

+56
-49
lines changed

config/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
root: true,
33

4-
parser: "vue-eslint-parser",
4+
parser: 'vue-eslint-parser',
55

66
parserOptions: {
77
ecmaVersion: 6,

config/recommended.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
extends: require.resolve('./base.js'),
3-
rules: require.resolve('./recommended-rules.js'),
3+
rules: require('../lib/recommended-rules.js'),
44
};

lib/recommended-rules.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@
44
* in order to update it's content execute "npm run update"
55
*/
66
module.exports = {
7-
"html-end-tags": "error",
8-
"html-no-self-closing": "error",
9-
"html-quotes": "off",
10-
"jsx-uses-vars": "error",
11-
"no-confusing-v-for-v-if": "error",
12-
"no-duplicate-attributes": "error",
13-
"no-invalid-template-root": "error",
14-
"no-invalid-v-bind": "error",
15-
"no-invalid-v-cloak": "error",
16-
"no-invalid-v-else-if": "error",
17-
"no-invalid-v-else": "error",
18-
"no-invalid-v-for": "error",
19-
"no-invalid-v-html": "error",
20-
"no-invalid-v-if": "error",
21-
"no-invalid-v-model": "error",
22-
"no-invalid-v-on": "error",
23-
"no-invalid-v-once": "error",
24-
"no-invalid-v-pre": "error",
25-
"no-invalid-v-show": "error",
26-
"no-invalid-v-text": "error",
27-
"no-parsing-error": "error",
28-
"no-textarea-mustache": "error",
29-
"require-component-is": "error",
30-
"require-v-for-key": "error",
31-
"v-bind-style": "off",
32-
"v-on-style": "off"
33-
}
7+
"vue/html-end-tags": "error",
8+
"vue/html-no-self-closing": "error",
9+
"vue/html-quotes": "off",
10+
"vue/no-confusing-v-for-v-if": "error",
11+
"vue/no-duplicate-attributes": "error",
12+
"vue/no-invalid-template-root": "error",
13+
"vue/no-invalid-v-bind": "error",
14+
"vue/no-invalid-v-cloak": "error",
15+
"vue/no-invalid-v-else-if": "error",
16+
"vue/no-invalid-v-else": "error",
17+
"vue/no-invalid-v-for": "error",
18+
"vue/no-invalid-v-html": "error",
19+
"vue/no-invalid-v-if": "error",
20+
"vue/no-invalid-v-model": "error",
21+
"vue/no-invalid-v-on": "error",
22+
"vue/no-invalid-v-once": "error",
23+
"vue/no-invalid-v-pre": "error",
24+
"vue/no-invalid-v-show": "error",
25+
"vue/no-invalid-v-text": "error",
26+
"vue/no-parsing-error": "error",
27+
"vue/no-textarea-mustache": "error",
28+
"vue/require-component-is": "error",
29+
"vue/require-v-for-key": "error",
30+
"vue/v-bind-style": "off",
31+
"vue/v-on-style": "off"
32+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "Official ESLint plugin for Vue.js",
55
"main": "lib/index.js",
66
"scripts": {
7-
"start": "npm run update && npm run test:simple -- --watch --growl",
7+
"start": "npm run test:simple -- --watch --growl",
88
"test:base": "mocha tests --recursive",
99
"test:simple": "npm run test:base -- --reporter nyan",
1010
"test": "nyc npm run test:base",
1111
"lint": "eslint .",
1212
"pretest": "npm run lint",
13-
"preversion": "npm test",
13+
"preversion": "npm run update && npm test",
1414
"postversion": "git push --follow-tags",
1515
"update": "node ./tools/update-rules.js"
1616
},

tools/update-rules.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const path = require("path")
1919
const root = path.resolve(__dirname, "../lib/rules")
2020
const readmeFile = path.resolve(__dirname, "../README.md")
2121
const recommendedRulesFile = path.resolve(__dirname, "../lib/recommended-rules.js")
22-
const categories = ["Possible Errors", "Best Practices", "Stylistic Issues"]
2322
const tablePlaceholder = /<!--RULES_TABLE_START-->[\s\S]*<!--RULES_TABLE_END-->/
2423
const readmeContent = fs.readFileSync(readmeFile, "utf8")
2524

@@ -34,28 +33,37 @@ const rules = fs.readdirSync(root)
3433
require(path.join(root, fileName)),
3534
])
3635

36+
const categories = rules
37+
.map(entry => entry[1].meta.docs.category)
38+
.reduce((arr, category) => {
39+
if (!arr.includes(category)) {
40+
arr.push(category);
41+
}
42+
return arr;
43+
}, [])
44+
3745
const rulesTableContent = categories.map(category => `
38-
### ${category}
46+
### ${category}
3947
40-
| | Rule ID | Description |
41-
|:---|:--------|:------------|
42-
${
43-
rules
44-
.filter(entry => entry[1].meta.docs.category === category)
45-
.map(entry => {
46-
const name = entry[0]
47-
const meta = entry[1].meta
48-
const mark = `${meta.docs.recommended ? STAR : ""}${meta.fixable ? PEN : ""}`
49-
const link = `[${name}](./docs/rules/${name}.md)`
50-
const description = meta.docs.description || "(no description)"
51-
return `| ${mark} | ${link} | ${description} |`
52-
})
53-
.join("\n")
54-
}
48+
| | Rule ID | Description |
49+
|:---|:--------|:------------|
50+
${
51+
rules
52+
.filter(entry => entry[1].meta.docs.category === category)
53+
.map(entry => {
54+
const name = entry[0]
55+
const meta = entry[1].meta
56+
const mark = `${meta.docs.recommended ? STAR : ""}${meta.fixable ? PEN : ""}`
57+
const link = `[${name}](./docs/rules/${name}.md)`
58+
const description = meta.docs.description || "(no description)"
59+
return `| ${mark} | ${link} | ${description} |`
60+
})
61+
.join("\n")
62+
}
5563
`).join("\n")
5664

5765
const recommendedRules = rules.reduce((obj, entry) => {
58-
const name = entry[0]
66+
const name = `vue/${entry[0]}`;
5967
const recommended = entry[1].meta.docs.recommended
6068
const status = recommended ? 'error' : 'off'
6169
obj[name] = status;

0 commit comments

Comments
 (0)