eslint-config-prettier 6.9.0 → 6.12.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.
- package/@typescript-eslint.js +5 -2
- package/CHANGELOG.md +67 -120
- package/README.md +130 -203
- package/babel.js +2 -2
- package/bin/cli.js +23 -23
- package/bin/validators.js +1 -1
- package/flowtype.js +2 -2
- package/index.js +3 -3
- package/package.json +20 -19
- package/react.js +3 -3
- package/standard.js +2 -2
- package/unicorn.js +2 -2
- package/vue.js +2 -2
package/babel.js
CHANGED
package/bin/cli.js
CHANGED
|
@@ -17,8 +17,8 @@ if (module === require.main) {
|
|
|
17
17
|
"This tool checks whether an ESLint configuration contains rules that are",
|
|
18
18
|
"unnecessary or conflict with Prettier. It’s supposed to be run like this:",
|
|
19
19
|
"",
|
|
20
|
-
" eslint --print-config path/to/main.js | eslint-config-prettier-check",
|
|
21
|
-
" eslint --print-config test/index.js | eslint-config-prettier-check",
|
|
20
|
+
" npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check",
|
|
21
|
+
" npx eslint --print-config test/index.js | npx eslint-config-prettier-check",
|
|
22
22
|
"",
|
|
23
23
|
"Exit codes:",
|
|
24
24
|
"",
|
|
@@ -27,14 +27,14 @@ if (module === require.main) {
|
|
|
27
27
|
"2: Conflicting rules found.",
|
|
28
28
|
"",
|
|
29
29
|
"For more information, see:",
|
|
30
|
-
"https://github.com/prettier/eslint-config-prettier#cli-helper-tool"
|
|
30
|
+
"https://github.com/prettier/eslint-config-prettier#cli-helper-tool",
|
|
31
31
|
].join("\n")
|
|
32
32
|
);
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
getStdin()
|
|
37
|
-
.then(string => {
|
|
37
|
+
.then((string) => {
|
|
38
38
|
const result = processString(string);
|
|
39
39
|
if (result.stderr) {
|
|
40
40
|
console.error(result.stderr);
|
|
@@ -44,7 +44,7 @@ if (module === require.main) {
|
|
|
44
44
|
}
|
|
45
45
|
process.exit(result.code);
|
|
46
46
|
})
|
|
47
|
-
.catch(error => {
|
|
47
|
+
.catch((error) => {
|
|
48
48
|
console.error("Unexpected error", error);
|
|
49
49
|
process.exit(1);
|
|
50
50
|
});
|
|
@@ -57,7 +57,7 @@ function processString(string) {
|
|
|
57
57
|
} catch (error) {
|
|
58
58
|
return {
|
|
59
59
|
stderr: `Failed to parse JSON:\n${error.message}`,
|
|
60
|
-
code: 1
|
|
60
|
+
code: 1,
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -69,7 +69,7 @@ function processString(string) {
|
|
|
69
69
|
) {
|
|
70
70
|
return {
|
|
71
71
|
stderr: `Expected a \`{"rules: {...}"}\` JSON object, but got:\n${string}`,
|
|
72
|
-
code: 1
|
|
72
|
+
code: 1,
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -80,8 +80,8 @@ function processString(string) {
|
|
|
80
80
|
Object.create(null),
|
|
81
81
|
...fs
|
|
82
82
|
.readdirSync(path.join(__dirname, ".."))
|
|
83
|
-
.filter(name => !name.startsWith(".") && name.endsWith(".js"))
|
|
84
|
-
.map(ruleFileName => require(`../${ruleFileName}`).rules)
|
|
83
|
+
.filter((name) => !name.startsWith(".") && name.endsWith(".js"))
|
|
84
|
+
.map((ruleFileName) => require(`../${ruleFileName}`).rules)
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const regularRules = filterRules(
|
|
@@ -98,7 +98,7 @@ function processString(string) {
|
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
const flaggedRules = Object.keys(config.rules)
|
|
101
|
-
.map(ruleName => {
|
|
101
|
+
.map((ruleName) => {
|
|
102
102
|
const value = config.rules[ruleName];
|
|
103
103
|
const arrayValue = Array.isArray(value) ? value : [value];
|
|
104
104
|
const level = arrayValue[0];
|
|
@@ -110,7 +110,7 @@ function processString(string) {
|
|
|
110
110
|
|
|
111
111
|
const regularFlaggedRuleNames = filterRuleNames(
|
|
112
112
|
flaggedRules,
|
|
113
|
-
ruleName => ruleName in regularRules
|
|
113
|
+
(ruleName) => ruleName in regularRules
|
|
114
114
|
);
|
|
115
115
|
const optionsFlaggedRuleNames = filterRuleNames(
|
|
116
116
|
flaggedRules,
|
|
@@ -119,7 +119,7 @@ function processString(string) {
|
|
|
119
119
|
);
|
|
120
120
|
const specialFlaggedRuleNames = filterRuleNames(
|
|
121
121
|
flaggedRules,
|
|
122
|
-
ruleName => ruleName in specialRules
|
|
122
|
+
(ruleName) => ruleName in specialRules
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
if (
|
|
@@ -138,52 +138,52 @@ function processString(string) {
|
|
|
138
138
|
"However, the following rules are enabled but cannot be automatically checked. See:",
|
|
139
139
|
SPECIAL_RULES_URL,
|
|
140
140
|
"",
|
|
141
|
-
printRuleNames(specialFlaggedRuleNames)
|
|
141
|
+
printRuleNames(specialFlaggedRuleNames),
|
|
142
142
|
].join("\n");
|
|
143
143
|
|
|
144
144
|
return {
|
|
145
145
|
stdout: message,
|
|
146
|
-
code: 0
|
|
146
|
+
code: 0,
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
const regularMessage = [
|
|
151
151
|
"The following rules are unnecessary or might conflict with Prettier:",
|
|
152
152
|
"",
|
|
153
|
-
printRuleNames(regularFlaggedRuleNames)
|
|
153
|
+
printRuleNames(regularFlaggedRuleNames),
|
|
154
154
|
].join("\n");
|
|
155
155
|
|
|
156
156
|
const optionsMessage = [
|
|
157
157
|
"The following rules are enabled with options that might conflict with Prettier. See:",
|
|
158
158
|
SPECIAL_RULES_URL,
|
|
159
159
|
"",
|
|
160
|
-
printRuleNames(optionsFlaggedRuleNames)
|
|
160
|
+
printRuleNames(optionsFlaggedRuleNames),
|
|
161
161
|
].join("\n");
|
|
162
162
|
|
|
163
163
|
const specialMessage = [
|
|
164
164
|
"The following rules are enabled but cannot be automatically checked. See:",
|
|
165
165
|
SPECIAL_RULES_URL,
|
|
166
166
|
"",
|
|
167
|
-
printRuleNames(specialFlaggedRuleNames)
|
|
167
|
+
printRuleNames(specialFlaggedRuleNames),
|
|
168
168
|
].join("\n");
|
|
169
169
|
|
|
170
170
|
const message = [
|
|
171
171
|
regularFlaggedRuleNames.length === 0 ? null : regularMessage,
|
|
172
172
|
optionsFlaggedRuleNames.length === 0 ? null : optionsMessage,
|
|
173
|
-
specialFlaggedRuleNames.length === 0 ? null : specialMessage
|
|
173
|
+
specialFlaggedRuleNames.length === 0 ? null : specialMessage,
|
|
174
174
|
]
|
|
175
175
|
.filter(Boolean)
|
|
176
176
|
.join("\n\n");
|
|
177
177
|
|
|
178
178
|
return {
|
|
179
179
|
stdout: message,
|
|
180
|
-
code: 2
|
|
180
|
+
code: 2,
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
function filterRules(rules, fn) {
|
|
185
185
|
return Object.keys(rules)
|
|
186
|
-
.filter(ruleName => fn(ruleName, rules[ruleName]))
|
|
186
|
+
.filter((ruleName) => fn(ruleName, rules[ruleName]))
|
|
187
187
|
.reduce((obj, ruleName) => {
|
|
188
188
|
obj[ruleName] = true;
|
|
189
189
|
return obj;
|
|
@@ -192,15 +192,15 @@ function filterRules(rules, fn) {
|
|
|
192
192
|
|
|
193
193
|
function filterRuleNames(rules, fn) {
|
|
194
194
|
return rules
|
|
195
|
-
.filter(rule => fn(rule.ruleName, rule.options))
|
|
196
|
-
.map(rule => rule.ruleName);
|
|
195
|
+
.filter((rule) => fn(rule.ruleName, rule.options))
|
|
196
|
+
.map((rule) => rule.ruleName);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
function printRuleNames(ruleNames) {
|
|
200
200
|
return ruleNames
|
|
201
201
|
.slice()
|
|
202
202
|
.sort()
|
|
203
|
-
.map(ruleName => `- ${ruleName}`)
|
|
203
|
+
.map((ruleName) => `- ${ruleName}`)
|
|
204
204
|
.join("\n");
|
|
205
205
|
}
|
|
206
206
|
|
package/bin/validators.js
CHANGED
package/flowtype.js
CHANGED
|
@@ -10,6 +10,6 @@ module.exports = {
|
|
|
10
10
|
"flowtype/space-after-type-colon": "off",
|
|
11
11
|
"flowtype/space-before-generic-bracket": "off",
|
|
12
12
|
"flowtype/space-before-type-colon": "off",
|
|
13
|
-
"flowtype/union-intersection-spacing": "off"
|
|
14
|
-
}
|
|
13
|
+
"flowtype/union-intersection-spacing": "off",
|
|
14
|
+
},
|
|
15
15
|
};
|
package/index.js
CHANGED
|
@@ -89,7 +89,7 @@ module.exports = {
|
|
|
89
89
|
"unicode-bom": "off",
|
|
90
90
|
"wrap-iife": "off",
|
|
91
91
|
"wrap-regex": "off",
|
|
92
|
-
"yield-star-spacing": "off"
|
|
92
|
+
"yield-star-spacing": "off",
|
|
93
93
|
},
|
|
94
94
|
includeDeprecated && {
|
|
95
95
|
// Deprecated since version 4.0.0.
|
|
@@ -97,7 +97,7 @@ module.exports = {
|
|
|
97
97
|
"indent-legacy": "off",
|
|
98
98
|
// Deprecated since version 3.3.0.
|
|
99
99
|
// https://eslint.org/docs/rules/no-spaced-func
|
|
100
|
-
"no-spaced-func": "off"
|
|
100
|
+
"no-spaced-func": "off",
|
|
101
101
|
}
|
|
102
|
-
)
|
|
102
|
+
),
|
|
103
103
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-prettier",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Simon Lydell",
|
|
6
6
|
"description": "Turns off all rules that are unnecessary or might conflict with Prettier.",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
28
|
"doctoc": "doctoc README.md && replace \"\\[\\[([\\w/-]+)\\](?:([^\\[\\]]+)\\[([\\w/-]+)\\])?\\]\" \"[\\$1\\$2\\$3]\" README.md",
|
|
29
|
-
"
|
|
29
|
+
"prettier": "prettier --write .",
|
|
30
|
+
"test:lint": "eslint . && prettier --check .",
|
|
30
31
|
"test:lint-verify-fail": "eslint \"test-lint/*.{js,ts,vue}\" --config .eslintrc.base.js --format json",
|
|
31
32
|
"test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json",
|
|
32
33
|
"test:deprecated": "eslint-find-rules --deprecated index.js",
|
|
@@ -39,26 +40,26 @@
|
|
|
39
40
|
"get-stdin": "^6.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "2.
|
|
43
|
-
"@typescript-eslint/parser": "2.
|
|
44
|
-
"babel-eslint": "10.0
|
|
45
|
-
"cross-spawn": "
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "4.2.0",
|
|
44
|
+
"@typescript-eslint/parser": "4.2.0",
|
|
45
|
+
"babel-eslint": "10.1.0",
|
|
46
|
+
"cross-spawn": "7.0.3",
|
|
46
47
|
"doctoc": "1.4.0",
|
|
47
|
-
"eslint": "
|
|
48
|
+
"eslint": "7.9.0",
|
|
48
49
|
"eslint-config-google": "0.14.0",
|
|
49
|
-
"eslint-find-rules": "3.
|
|
50
|
-
"eslint-plugin-babel": "5.3.
|
|
51
|
-
"eslint-plugin-flowtype": "
|
|
52
|
-
"eslint-plugin-prettier": "3.1.
|
|
53
|
-
"eslint-plugin-react": "7.
|
|
50
|
+
"eslint-find-rules": "3.6.1",
|
|
51
|
+
"eslint-plugin-babel": "5.3.1",
|
|
52
|
+
"eslint-plugin-flowtype": "5.2.0",
|
|
53
|
+
"eslint-plugin-prettier": "3.1.4",
|
|
54
|
+
"eslint-plugin-react": "7.21.2",
|
|
54
55
|
"eslint-plugin-standard": "4.0.1",
|
|
55
|
-
"eslint-plugin-unicorn": "
|
|
56
|
-
"eslint-plugin-vue": "6.
|
|
57
|
-
"jest": "
|
|
58
|
-
"prettier": "1.
|
|
59
|
-
"replace": "1.
|
|
60
|
-
"rimraf": "3.0.
|
|
61
|
-
"typescript": "
|
|
56
|
+
"eslint-plugin-unicorn": "22.0.0",
|
|
57
|
+
"eslint-plugin-vue": "6.2.2",
|
|
58
|
+
"jest": "26.4.2",
|
|
59
|
+
"prettier": "2.1.2",
|
|
60
|
+
"replace": "1.2.0",
|
|
61
|
+
"rimraf": "3.0.2",
|
|
62
|
+
"typescript": "4.0.3"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"eslint": ">=3.14.1"
|
package/react.js
CHANGED
|
@@ -18,12 +18,12 @@ module.exports = {
|
|
|
18
18
|
"react/jsx-one-expression-per-line": "off",
|
|
19
19
|
"react/jsx-props-no-multi-spaces": "off",
|
|
20
20
|
"react/jsx-tag-spacing": "off",
|
|
21
|
-
"react/jsx-wrap-multilines": "off"
|
|
21
|
+
"react/jsx-wrap-multilines": "off",
|
|
22
22
|
},
|
|
23
23
|
includeDeprecated && {
|
|
24
24
|
// Deprecated since version 7.0.0.
|
|
25
25
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
|
|
26
|
-
"react/jsx-space-before-closing": "off"
|
|
26
|
+
"react/jsx-space-before-closing": "off",
|
|
27
27
|
}
|
|
28
|
-
)
|
|
28
|
+
),
|
|
29
29
|
};
|
package/standard.js
CHANGED
package/unicorn.js
CHANGED
package/vue.js
CHANGED