Socket
Socket
Sign inDemoInstall

eslint-config-prettier

Package Overview
Dependencies
88
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.2.0 to 8.0.0

97

bin/cli.js

@@ -5,5 +5,5 @@ #!/usr/bin/env node

const fs = require("fs");
const path = require("path");
const validators = require("./validators");
const config = require("..");
const prettier = require("../prettier");

@@ -19,2 +19,5 @@ // Require locally installed eslint, for `npx eslint-config-prettier` support

const PRETTIER_RULES_URL =
"https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback";
if (module === require.main) {

@@ -33,4 +36,4 @@ const args = process.argv.slice(2);

const rules = [].concat(
...configs.map((config, index) =>
Object.entries(config.rules).map((entry) => [...entry, args[index]])
...configs.map(({ rules }, index) =>
Object.entries(rules).map((entry) => [...entry, args[index]])
)

@@ -74,20 +77,9 @@ );

function processRules(configRules) {
// This used to look at "files" in package.json, but that is not reliable due
// to an npm bug. See:
// https://github.com/prettier/eslint-config-prettier/issues/57
const allRules = Object.assign(
Object.create(null),
...fs
.readdirSync(path.join(__dirname, ".."))
.filter((name) => !name.startsWith(".") && name.endsWith(".js"))
.map((ruleFileName) => require(`../${ruleFileName}`).rules)
);
const regularRules = filterRules(allRules, (_, value) => value === "off");
const regularRules = filterRules(config.rules, (_, value) => value === "off");
const optionsRules = filterRules(
allRules,
config.rules,
(ruleName, value) => value === 0 && ruleName in validators
);
const specialRules = filterRules(
allRules,
config.rules,
(ruleName, value) => value === 0 && !(ruleName in validators)

@@ -106,3 +98,3 @@ );

const flaggedRules = enabledRules.filter(
({ ruleName }) => ruleName in allRules
({ ruleName }) => ruleName in config.rules
);

@@ -117,3 +109,3 @@

({ ruleName, ...rule }) =>
ruleName in optionsRules && !validators[ruleName](rule, enabledRules)
ruleName in optionsRules && !validators[ruleName](rule)
);

@@ -124,28 +116,12 @@ const specialFlaggedRuleNames = filterRuleNames(

);
const prettierFlaggedRuleNames = filterRuleNames(
enabledRules,
({ ruleName, source }) =>
ruleName in prettier.rules &&
enabledRules.some(
(rule) =>
rule.ruleName === "prettier/prettier" && rule.source === source
)
);
if (
regularFlaggedRuleNames.length === 0 &&
optionsFlaggedRuleNames.length === 0
) {
const baseMessage =
"No rules that are unnecessary or conflict with Prettier were found.";
const message =
specialFlaggedRuleNames.length === 0
? baseMessage
: [
baseMessage,
"",
"However, the following rules are enabled but cannot be automatically checked. See:",
SPECIAL_RULES_URL,
"",
printRuleNames(specialFlaggedRuleNames),
].join("\n");
return {
stdout: message,
code: 0,
};
}
const regularMessage = [

@@ -171,2 +147,32 @@ "The following rules are unnecessary or might conflict with Prettier:",

const prettierMessage = [
"The following rules can cause issues when using eslint-plugin-prettier at the same time.",
"Only enable them if you know what you are doing! See:",
PRETTIER_RULES_URL,
"",
printRuleNames(prettierFlaggedRuleNames),
].join("\n");
if (
regularFlaggedRuleNames.length === 0 &&
optionsFlaggedRuleNames.length === 0
) {
const message =
specialFlaggedRuleNames.length === 0 &&
prettierFlaggedRuleNames.length === 0
? "No rules that are unnecessary or conflict with Prettier were found."
: [
specialFlaggedRuleNames.length === 0 ? null : specialMessage,
prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
"Other than that, no rules that are unnecessary or conflict with Prettier were found.",
]
.filter(Boolean)
.join("\n\n");
return {
stdout: message,
code: 0,
};
}
const message = [

@@ -176,2 +182,3 @@ regularFlaggedRuleNames.length === 0 ? null : regularMessage,

specialFlaggedRuleNames.length === 0 ? null : specialMessage,
prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
]

@@ -178,0 +185,0 @@ .filter(Boolean)

@@ -7,5 +7,3 @@ "use strict";

module.exports = {
"arrow-body-style": checkEslintPluginPrettier,
curly({ options }) {
"curly"({ options }) {
if (options.length === 0) {

@@ -54,4 +52,2 @@ return true;

"prefer-arrow-callback": checkEslintPluginPrettier,
"vue/html-self-closing"({ options }) {

@@ -70,8 +66,1 @@ if (options.length === 0) {

};
function checkEslintPluginPrettier({ source: currentSource }, enabledRules) {
return !enabledRules.some(
({ ruleName, source }) =>
ruleName === "prettier/prettier" && currentSource === source
);
}

@@ -10,3 +10,3 @@ "use strict";

// script can distinguish them.)
curly: 0,
"curly": 0,
"lines-around-comment": 0,

@@ -18,3 +18,8 @@ "max-len": 0,

"no-unexpected-multiline": 0,
quotes: 0,
"quotes": 0,
"@typescript-eslint/quotes": 0,
"babel/quotes": 0,
"vue/html-self-closing": 0,
"vue/max-len": 0,
// The rest are rules that you never need to enable when using Prettier.

@@ -40,3 +45,3 @@ "array-bracket-newline": "off",

"implicit-arrow-linebreak": "off",
indent: "off",
"indent": "off",
"jsx-quotes": "off",

@@ -71,3 +76,3 @@ "key-spacing": "off",

"rest-spread-spacing": "off",
semi: "off",
"semi": "off",
"semi-spacing": "off",

@@ -94,2 +99,83 @@ "semi-style": "off",

"yield-star-spacing": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/comma-spacing": "off",
"@typescript-eslint/func-call-spacing": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/keyword-spacing": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-extra-parens": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/object-curly-spacing": "off",
"@typescript-eslint/semi": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/space-infix-ops": "off",
"@typescript-eslint/type-annotation-spacing": "off",
"babel/object-curly-spacing": "off",
"babel/semi": "off",
"flowtype/boolean-style": "off",
"flowtype/delimiter-dangle": "off",
"flowtype/generic-spacing": "off",
"flowtype/object-type-delimiter": "off",
"flowtype/semi": "off",
"flowtype/space-after-type-colon": "off",
"flowtype/space-before-generic-bracket": "off",
"flowtype/space-before-type-colon": "off",
"flowtype/union-intersection-spacing": "off",
"react/jsx-child-element-spacing": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-closing-tag-location": "off",
"react/jsx-curly-newline": "off",
"react/jsx-curly-spacing": "off",
"react/jsx-equals-spacing": "off",
"react/jsx-first-prop-new-line": "off",
"react/jsx-indent": "off",
"react/jsx-indent-props": "off",
"react/jsx-max-props-per-line": "off",
"react/jsx-newline": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-props-no-multi-spaces": "off",
"react/jsx-tag-spacing": "off",
"react/jsx-wrap-multilines": "off",
"standard/array-bracket-even-spacing": "off",
"standard/computed-property-even-spacing": "off",
"standard/object-curly-even-spacing": "off",
"unicorn/empty-brace-spaces": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/number-literal-case": "off",
"vue/array-bracket-newline": "off",
"vue/array-bracket-spacing": "off",
"vue/arrow-spacing": "off",
"vue/block-spacing": "off",
"vue/block-tag-newline": "off",
"vue/brace-style": "off",
"vue/comma-dangle": "off",
"vue/comma-spacing": "off",
"vue/comma-style": "off",
"vue/dot-location": "off",
"vue/func-call-spacing": "off",
"vue/html-closing-bracket-newline": "off",
"vue/html-closing-bracket-spacing": "off",
"vue/html-end-tags": "off",
"vue/html-indent": "off",
"vue/html-quotes": "off",
"vue/key-spacing": "off",
"vue/keyword-spacing": "off",
"vue/max-attributes-per-line": "off",
"vue/multiline-html-element-content-newline": "off",
"vue/mustache-interpolation-spacing": "off",
"vue/no-extra-parens": "off",
"vue/no-multi-spaces": "off",
"vue/no-spaces-around-equal-signs-in-attribute": "off",
"vue/object-curly-newline": "off",
"vue/object-curly-spacing": "off",
"vue/object-property-newline": "off",
"vue/operator-linebreak": "off",
"vue/script-indent": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/space-in-parens": "off",
"vue/space-infix-ops": "off",
"vue/space-unary-ops": "off",
"vue/template-curly-spacing": "off",
...(includeDeprecated && {

@@ -102,4 +188,7 @@ // Deprecated since version 4.0.0.

"no-spaced-func": "off",
// Deprecated since version 7.0.0.
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
"react/jsx-space-before-closing": "off",
}),
},
};
{
"name": "eslint-config-prettier",
"version": "7.2.0",
"version": "8.0.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Simon Lydell",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc