eslint-config-prettier 7.2.0 → 8.3.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.
@@ -1,22 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "@typescript-eslint/quotes": 0,
6
-
7
- "@typescript-eslint/brace-style": "off",
8
- "@typescript-eslint/comma-dangle": "off",
9
- "@typescript-eslint/comma-spacing": "off",
10
- "@typescript-eslint/func-call-spacing": "off",
11
- "@typescript-eslint/indent": "off",
12
- "@typescript-eslint/keyword-spacing": "off",
13
- "@typescript-eslint/member-delimiter-style": "off",
14
- "@typescript-eslint/no-extra-parens": "off",
15
- "@typescript-eslint/no-extra-semi": "off",
16
- "@typescript-eslint/object-curly-spacing": "off",
17
- "@typescript-eslint/semi": "off",
18
- "@typescript-eslint/space-before-function-paren": "off",
19
- "@typescript-eslint/space-infix-ops": "off",
20
- "@typescript-eslint/type-annotation-spacing": "off",
21
- },
22
- };
1
+ throw new Error(
2
+ '"prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/babel.js CHANGED
@@ -1,10 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "babel/quotes": 0,
6
-
7
- "babel/object-curly-spacing": "off",
8
- "babel/semi": "off",
9
- },
10
- };
1
+ throw new Error(
2
+ '"prettier/babel" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/bin/cli.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const fs = require("fs");
6
- const path = require("path");
7
5
  const validators = require("./validators");
6
+ const config = require("..");
7
+ const prettier = require("../prettier");
8
8
 
9
9
  // Require locally installed eslint, for `npx eslint-config-prettier` support
10
10
  // with no local eslint-config-prettier installation.
@@ -15,6 +15,9 @@ const { ESLint } = require(require.resolve("eslint", {
15
15
  const SPECIAL_RULES_URL =
16
16
  "https://github.com/prettier/eslint-config-prettier#special-rules";
17
17
 
18
+ const PRETTIER_RULES_URL =
19
+ "https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback";
20
+
18
21
  if (module === require.main) {
19
22
  const args = process.argv.slice(2);
20
23
 
@@ -28,8 +31,8 @@ if (module === require.main) {
28
31
  Promise.all(args.map((file) => eslint.calculateConfigForFile(file)))
29
32
  .then((configs) => {
30
33
  const rules = [].concat(
31
- ...configs.map((config, index) =>
32
- Object.entries(config.rules).map((entry) => [...entry, args[index]])
34
+ ...configs.map(({ rules }, index) =>
35
+ Object.entries(rules).map((entry) => [...entry, args[index]])
33
36
  )
34
37
  );
35
38
  const result = processRules(rules);
@@ -68,24 +71,13 @@ https://github.com/prettier/eslint-config-prettier#cli-helper-tool
68
71
  }
69
72
 
70
73
  function processRules(configRules) {
71
- // This used to look at "files" in package.json, but that is not reliable due
72
- // to an npm bug. See:
73
- // https://github.com/prettier/eslint-config-prettier/issues/57
74
- const allRules = Object.assign(
75
- Object.create(null),
76
- ...fs
77
- .readdirSync(path.join(__dirname, ".."))
78
- .filter((name) => !name.startsWith(".") && name.endsWith(".js"))
79
- .map((ruleFileName) => require(`../${ruleFileName}`).rules)
80
- );
81
-
82
- const regularRules = filterRules(allRules, (_, value) => value === "off");
74
+ const regularRules = filterRules(config.rules, (_, value) => value === "off");
83
75
  const optionsRules = filterRules(
84
- allRules,
76
+ config.rules,
85
77
  (ruleName, value) => value === 0 && ruleName in validators
86
78
  );
87
79
  const specialRules = filterRules(
88
- allRules,
80
+ config.rules,
89
81
  (ruleName, value) => value === 0 && !(ruleName in validators)
90
82
  );
91
83
 
@@ -99,7 +91,7 @@ function processRules(configRules) {
99
91
  .filter(Boolean);
100
92
 
101
93
  const flaggedRules = enabledRules.filter(
102
- ({ ruleName }) => ruleName in allRules
94
+ ({ ruleName }) => ruleName in config.rules
103
95
  );
104
96
 
105
97
  const regularFlaggedRuleNames = filterRuleNames(
@@ -109,37 +101,21 @@ function processRules(configRules) {
109
101
  const optionsFlaggedRuleNames = filterRuleNames(
110
102
  flaggedRules,
111
103
  ({ ruleName, ...rule }) =>
112
- ruleName in optionsRules && !validators[ruleName](rule, enabledRules)
104
+ ruleName in optionsRules && !validators[ruleName](rule)
113
105
  );
114
106
  const specialFlaggedRuleNames = filterRuleNames(
115
107
  flaggedRules,
116
108
  ({ ruleName }) => ruleName in specialRules
117
109
  );
118
-
119
- if (
120
- regularFlaggedRuleNames.length === 0 &&
121
- optionsFlaggedRuleNames.length === 0
122
- ) {
123
- const baseMessage =
124
- "No rules that are unnecessary or conflict with Prettier were found.";
125
-
126
- const message =
127
- specialFlaggedRuleNames.length === 0
128
- ? baseMessage
129
- : [
130
- baseMessage,
131
- "",
132
- "However, the following rules are enabled but cannot be automatically checked. See:",
133
- SPECIAL_RULES_URL,
134
- "",
135
- printRuleNames(specialFlaggedRuleNames),
136
- ].join("\n");
137
-
138
- return {
139
- stdout: message,
140
- code: 0,
141
- };
142
- }
110
+ const prettierFlaggedRuleNames = filterRuleNames(
111
+ enabledRules,
112
+ ({ ruleName, source }) =>
113
+ ruleName in prettier.rules &&
114
+ enabledRules.some(
115
+ (rule) =>
116
+ rule.ruleName === "prettier/prettier" && rule.source === source
117
+ )
118
+ );
143
119
 
144
120
  const regularMessage = [
145
121
  "The following rules are unnecessary or might conflict with Prettier:",
@@ -161,10 +137,41 @@ function processRules(configRules) {
161
137
  printRuleNames(specialFlaggedRuleNames),
162
138
  ].join("\n");
163
139
 
140
+ const prettierMessage = [
141
+ "The following rules can cause issues when using eslint-plugin-prettier at the same time.",
142
+ "Only enable them if you know what you are doing! See:",
143
+ PRETTIER_RULES_URL,
144
+ "",
145
+ printRuleNames(prettierFlaggedRuleNames),
146
+ ].join("\n");
147
+
148
+ if (
149
+ regularFlaggedRuleNames.length === 0 &&
150
+ optionsFlaggedRuleNames.length === 0
151
+ ) {
152
+ const message =
153
+ specialFlaggedRuleNames.length === 0 &&
154
+ prettierFlaggedRuleNames.length === 0
155
+ ? "No rules that are unnecessary or conflict with Prettier were found."
156
+ : [
157
+ specialFlaggedRuleNames.length === 0 ? null : specialMessage,
158
+ prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
159
+ "Other than that, no rules that are unnecessary or conflict with Prettier were found.",
160
+ ]
161
+ .filter(Boolean)
162
+ .join("\n\n");
163
+
164
+ return {
165
+ stdout: message,
166
+ code: 0,
167
+ };
168
+ }
169
+
164
170
  const message = [
165
171
  regularFlaggedRuleNames.length === 0 ? null : regularMessage,
166
172
  optionsFlaggedRuleNames.length === 0 ? null : optionsMessage,
167
173
  specialFlaggedRuleNames.length === 0 ? null : specialMessage,
174
+ prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
168
175
  ]
169
176
  .filter(Boolean)
170
177
  .join("\n\n");
package/bin/validators.js CHANGED
@@ -4,9 +4,7 @@
4
4
  // `false` if the options DO conflict with Prettier, and `true` if they don’t.
5
5
 
6
6
  module.exports = {
7
- "arrow-body-style": checkEslintPluginPrettier,
8
-
9
- curly({ options }) {
7
+ "curly"({ options }) {
10
8
  if (options.length === 0) {
11
9
  return true;
12
10
  }
@@ -50,8 +48,6 @@ module.exports = {
50
48
  return Boolean(firstOption && firstOption.allowIndentationTabs);
51
49
  },
52
50
 
53
- "prefer-arrow-callback": checkEslintPluginPrettier,
54
-
55
51
  "vue/html-self-closing"({ options }) {
56
52
  if (options.length === 0) {
57
53
  return false;
@@ -65,10 +61,3 @@ module.exports = {
65
61
  );
66
62
  },
67
63
  };
68
-
69
- function checkEslintPluginPrettier({ source: currentSource }, enabledRules) {
70
- return !enabledRules.some(
71
- ({ ruleName, source }) =>
72
- ruleName === "prettier/prettier" && currentSource === source
73
- );
74
- }
package/flowtype.js CHANGED
@@ -1,15 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "flowtype/boolean-style": "off",
6
- "flowtype/delimiter-dangle": "off",
7
- "flowtype/generic-spacing": "off",
8
- "flowtype/object-type-delimiter": "off",
9
- "flowtype/semi": "off",
10
- "flowtype/space-after-type-colon": "off",
11
- "flowtype/space-before-generic-bracket": "off",
12
- "flowtype/space-before-type-colon": "off",
13
- "flowtype/union-intersection-spacing": "off",
14
- },
15
- };
1
+ throw new Error(
2
+ '"prettier/flowtype" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/index.js CHANGED
@@ -7,14 +7,19 @@ module.exports = {
7
7
  // The following rules can be used in some cases. See the README for more
8
8
  // information. (These are marked with `0` instead of `"off"` so that a
9
9
  // script can distinguish them.)
10
- curly: 0,
10
+ "curly": 0,
11
11
  "lines-around-comment": 0,
12
12
  "max-len": 0,
13
13
  "no-confusing-arrow": 0,
14
14
  "no-mixed-operators": 0,
15
15
  "no-tabs": 0,
16
16
  "no-unexpected-multiline": 0,
17
- quotes: 0,
17
+ "quotes": 0,
18
+ "@typescript-eslint/quotes": 0,
19
+ "babel/quotes": 0,
20
+ "vue/html-self-closing": 0,
21
+ "vue/max-len": 0,
22
+
18
23
  // The rest are rules that you never need to enable when using Prettier.
19
24
  "array-bracket-newline": "off",
20
25
  "array-bracket-spacing": "off",
@@ -35,7 +40,7 @@ module.exports = {
35
40
  "generator-star": "off",
36
41
  "generator-star-spacing": "off",
37
42
  "implicit-arrow-linebreak": "off",
38
- indent: "off",
43
+ "indent": "off",
39
44
  "jsx-quotes": "off",
40
45
  "key-spacing": "off",
41
46
  "keyword-spacing": "off",
@@ -65,7 +70,7 @@ module.exports = {
65
70
  "padded-blocks": "off",
66
71
  "quote-props": "off",
67
72
  "rest-spread-spacing": "off",
68
- semi: "off",
73
+ "semi": "off",
69
74
  "semi-spacing": "off",
70
75
  "semi-style": "off",
71
76
  "space-after-function-name": "off",
@@ -87,6 +92,91 @@ module.exports = {
87
92
  "wrap-iife": "off",
88
93
  "wrap-regex": "off",
89
94
  "yield-star-spacing": "off",
95
+ "@babel/object-curly-spacing": "off",
96
+ "@babel/semi": "off",
97
+ "@typescript-eslint/brace-style": "off",
98
+ "@typescript-eslint/comma-dangle": "off",
99
+ "@typescript-eslint/comma-spacing": "off",
100
+ "@typescript-eslint/func-call-spacing": "off",
101
+ "@typescript-eslint/indent": "off",
102
+ "@typescript-eslint/keyword-spacing": "off",
103
+ "@typescript-eslint/member-delimiter-style": "off",
104
+ "@typescript-eslint/no-extra-parens": "off",
105
+ "@typescript-eslint/no-extra-semi": "off",
106
+ "@typescript-eslint/object-curly-spacing": "off",
107
+ "@typescript-eslint/semi": "off",
108
+ "@typescript-eslint/space-before-function-paren": "off",
109
+ "@typescript-eslint/space-infix-ops": "off",
110
+ "@typescript-eslint/type-annotation-spacing": "off",
111
+ "babel/object-curly-spacing": "off",
112
+ "babel/semi": "off",
113
+ "flowtype/boolean-style": "off",
114
+ "flowtype/delimiter-dangle": "off",
115
+ "flowtype/generic-spacing": "off",
116
+ "flowtype/object-type-curly-spacing": "off",
117
+ "flowtype/object-type-delimiter": "off",
118
+ "flowtype/quotes": "off",
119
+ "flowtype/semi": "off",
120
+ "flowtype/space-after-type-colon": "off",
121
+ "flowtype/space-before-generic-bracket": "off",
122
+ "flowtype/space-before-type-colon": "off",
123
+ "flowtype/union-intersection-spacing": "off",
124
+ "react/jsx-child-element-spacing": "off",
125
+ "react/jsx-closing-bracket-location": "off",
126
+ "react/jsx-closing-tag-location": "off",
127
+ "react/jsx-curly-newline": "off",
128
+ "react/jsx-curly-spacing": "off",
129
+ "react/jsx-equals-spacing": "off",
130
+ "react/jsx-first-prop-new-line": "off",
131
+ "react/jsx-indent": "off",
132
+ "react/jsx-indent-props": "off",
133
+ "react/jsx-max-props-per-line": "off",
134
+ "react/jsx-newline": "off",
135
+ "react/jsx-one-expression-per-line": "off",
136
+ "react/jsx-props-no-multi-spaces": "off",
137
+ "react/jsx-tag-spacing": "off",
138
+ "react/jsx-wrap-multilines": "off",
139
+ "standard/array-bracket-even-spacing": "off",
140
+ "standard/computed-property-even-spacing": "off",
141
+ "standard/object-curly-even-spacing": "off",
142
+ "unicorn/empty-brace-spaces": "off",
143
+ "unicorn/no-nested-ternary": "off",
144
+ "unicorn/number-literal-case": "off",
145
+ "vue/array-bracket-newline": "off",
146
+ "vue/array-bracket-spacing": "off",
147
+ "vue/arrow-spacing": "off",
148
+ "vue/block-spacing": "off",
149
+ "vue/block-tag-newline": "off",
150
+ "vue/brace-style": "off",
151
+ "vue/comma-dangle": "off",
152
+ "vue/comma-spacing": "off",
153
+ "vue/comma-style": "off",
154
+ "vue/dot-location": "off",
155
+ "vue/func-call-spacing": "off",
156
+ "vue/html-closing-bracket-newline": "off",
157
+ "vue/html-closing-bracket-spacing": "off",
158
+ "vue/html-end-tags": "off",
159
+ "vue/html-indent": "off",
160
+ "vue/html-quotes": "off",
161
+ "vue/key-spacing": "off",
162
+ "vue/keyword-spacing": "off",
163
+ "vue/max-attributes-per-line": "off",
164
+ "vue/multiline-html-element-content-newline": "off",
165
+ "vue/mustache-interpolation-spacing": "off",
166
+ "vue/no-extra-parens": "off",
167
+ "vue/no-multi-spaces": "off",
168
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
169
+ "vue/object-curly-newline": "off",
170
+ "vue/object-curly-spacing": "off",
171
+ "vue/object-property-newline": "off",
172
+ "vue/operator-linebreak": "off",
173
+ "vue/script-indent": "off",
174
+ "vue/singleline-html-element-content-newline": "off",
175
+ "vue/space-in-parens": "off",
176
+ "vue/space-infix-ops": "off",
177
+ "vue/space-unary-ops": "off",
178
+ "vue/template-curly-spacing": "off",
179
+
90
180
  ...(includeDeprecated && {
91
181
  // Deprecated since version 4.0.0.
92
182
  // https://github.com/eslint/eslint/pull/8286
@@ -94,6 +184,9 @@ module.exports = {
94
184
  // Deprecated since version 3.3.0.
95
185
  // https://eslint.org/docs/rules/no-spaced-func
96
186
  "no-spaced-func": "off",
187
+ // Deprecated since version 7.0.0.
188
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
189
+ "react/jsx-space-before-closing": "off",
97
190
  }),
98
191
  },
99
192
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-prettier",
3
- "version": "7.2.0",
3
+ "version": "8.3.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.",
package/react.js CHANGED
@@ -1,28 +1,3 @@
1
- "use strict";
2
-
3
- const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
4
-
5
- module.exports = {
6
- rules: {
7
- "react/jsx-child-element-spacing": "off",
8
- "react/jsx-closing-bracket-location": "off",
9
- "react/jsx-closing-tag-location": "off",
10
- "react/jsx-curly-newline": "off",
11
- "react/jsx-curly-spacing": "off",
12
- "react/jsx-equals-spacing": "off",
13
- "react/jsx-first-prop-new-line": "off",
14
- "react/jsx-indent": "off",
15
- "react/jsx-indent-props": "off",
16
- "react/jsx-max-props-per-line": "off",
17
- "react/jsx-newline": "off",
18
- "react/jsx-one-expression-per-line": "off",
19
- "react/jsx-props-no-multi-spaces": "off",
20
- "react/jsx-tag-spacing": "off",
21
- "react/jsx-wrap-multilines": "off",
22
- ...(includeDeprecated && {
23
- // Deprecated since version 7.0.0.
24
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
25
- "react/jsx-space-before-closing": "off",
26
- }),
27
- },
28
- };
1
+ throw new Error(
2
+ '"prettier/react" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/standard.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "standard/array-bracket-even-spacing": "off",
6
- "standard/computed-property-even-spacing": "off",
7
- "standard/object-curly-even-spacing": "off",
8
- },
9
- };
1
+ throw new Error(
2
+ '"prettier/standard" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/unicorn.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "unicorn/empty-brace-spaces": "off",
6
- "unicorn/no-nested-ternary": "off",
7
- "unicorn/number-literal-case": "off",
8
- },
9
- };
1
+ throw new Error(
2
+ '"prettier/unicorn" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );
package/vue.js CHANGED
@@ -1,43 +1,3 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- rules: {
5
- "vue/html-self-closing": 0,
6
- "vue/max-len": 0,
7
-
8
- "vue/array-bracket-newline": "off",
9
- "vue/array-bracket-spacing": "off",
10
- "vue/arrow-spacing": "off",
11
- "vue/block-spacing": "off",
12
- "vue/block-tag-newline": "off",
13
- "vue/brace-style": "off",
14
- "vue/comma-dangle": "off",
15
- "vue/comma-spacing": "off",
16
- "vue/comma-style": "off",
17
- "vue/dot-location": "off",
18
- "vue/func-call-spacing": "off",
19
- "vue/html-closing-bracket-newline": "off",
20
- "vue/html-closing-bracket-spacing": "off",
21
- "vue/html-end-tags": "off",
22
- "vue/html-indent": "off",
23
- "vue/html-quotes": "off",
24
- "vue/key-spacing": "off",
25
- "vue/keyword-spacing": "off",
26
- "vue/max-attributes-per-line": "off",
27
- "vue/multiline-html-element-content-newline": "off",
28
- "vue/mustache-interpolation-spacing": "off",
29
- "vue/no-extra-parens": "off",
30
- "vue/no-multi-spaces": "off",
31
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
32
- "vue/object-curly-newline": "off",
33
- "vue/object-curly-spacing": "off",
34
- "vue/object-property-newline": "off",
35
- "vue/operator-linebreak": "off",
36
- "vue/script-indent": "off",
37
- "vue/singleline-html-element-content-newline": "off",
38
- "vue/space-in-parens": "off",
39
- "vue/space-infix-ops": "off",
40
- "vue/space-unary-ops": "off",
41
- "vue/template-curly-spacing": "off",
42
- },
43
- };
1
+ throw new Error(
2
+ '"prettier/vue" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21'
3
+ );