Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rule "no-multi-spaces" changed in eslint 4.4.0 #9079

Closed
doberkofler opened this issue Aug 6, 2017 · 4 comments
Closed

rule "no-multi-spaces" changed in eslint 4.4.0 #9079

doberkofler opened this issue Aug 6, 2017 · 4 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly regression Something broke rule Relates to ESLint's core rules

Comments

@doberkofler
Copy link
Contributor

doberkofler commented Aug 6, 2017

Tell us about your environment

  • ESLint Version: 4.4.0
  • Node Version: 8.1.4
  • npm Version: 4.6.1

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Configuration
{
    "parserOptions": {
        "ecmaVersion": 2017
    },
	"env": {
        "es6": true
    },
    "extends": "eslint:recommended",
    "globals": {
    },
    "plugins": [
    ],
    "rules": {
        // Possible Errors
		"for-direction": "error",
		"no-await-in-loop": "error",
        "no-console": "off",
        "no-debugger": "warn",
        "no-extra-boolean-cast": "warn",
		"no-extra-parens": "off",
		"no-unsafe-finally": "error",
		"no-prototype-builtins": "off",
		"no-template-curly-in-string": "error",
        "valid-jsdoc": ["warn", {
			"prefer": {
				"return": "returns",
				"argument": "param",
				"arg": "param",
				"constructor": "class",
				"virtual": "abstract"
			},
			"preferType": {
				"Boolean": "boolean",
				"Number": "number",
				"String": "string",
				"object": "Object",
				"array": "Array",
				"date": "Date"
			},
			"matchDescription": ".+",
            "requireParamDescription": true,
            "requireReturnDescription": true,
            "requireReturn": false,
			"requireReturnType": true
        }],

        // Best Practices
		"array-callback-return": "warn",
		"class-methods-use-this": "warn",
//		"complexity": ["warn", 60], !!!
        "consistent-return": "warn",
        "curly": ["error", "all"],
        "default-case": "error",
        "dot-notation": ["error", {"allowKeywords": true, "allowPattern": "^[a-zA-Z]+(_[a-zA-Z]+)+$"}],
        "eqeqeq": "error",
        "guard-for-in": "error",
        "no-alert": "off",
        "no-caller": "error",
        "no-case-declarations": "error",
        "no-div-regex": "error",
        "no-else-return": "warn",
        "no-empty-pattern": "warn",
        "no-eq-null": "error",
        "no-eval": "error",
        "no-extend-native": "error",
        "no-extra-bind": "error",
		"no-extra-label": "warn",
        "no-fallthrough": "warn",
        "no-floating-decimal": "error",
        "no-implicit-coercion": ["warn", {"boolean": true, "number": true, "string": true}],
		"no-implicit-globals": "off", // !!!
        "no-implied-eval": "error",
        "no-iterator": "error",
        "no-labels": ["error", {"allowLoop": false, "allowSwitch": false}],
        "no-lone-blocks": "off",
        "no-loop-func": "error",
        "no-magic-numbers": "off",
	"no-multi-spaces": ["warn", {"ignoreEOLComments": true}],
        "no-multi-str": "error",
        "no-native-reassign": "error",
        "no-new": "error",
        "no-new-func": "error",
        "no-new-wrappers": "error",
        "no-octal-escape": "error",
        "no-octal": "error",
        "no-process-env": "error",
        "no-proto": "error",
        "no-redeclare": "error",
		"no-restricted-globals": [
			"error",
			// event is globally available but causes problems when used (e.preventDefault()) in a jQuery callback
			// but has not been defined as a parameter to the callback
			"event",
			"jQuery"
		],
		"no-restricted-properties": [
			"error", {
				"object": "$",
				"property": "each",
				"message": "Use native es2015 forEach."
	        },
			{
				"object": "$",
				"property": "camelCase"
	        },
			{
				"object": "$",
				"property": "cookie"
	        },
			{
				"object": "$",
				"property": "error"
	        },
			{
				"object": "$",
				"property": "extend"
	        },
			{
				"object": "$",
				"property": "globalEval"
	        },
			{
				"object": "$",
				"property": "grep"
	        },
			{
				"object": "$",
				"property": "inArray"
	        },
			{
				"object": "$",
				"property": "isArray"
	        },
			{
				"object": "$",
				"property": "isEmptyObject"
	        },
			{
				"object": "$",
				"property": "isFunction"
	        },
			{
				"object": "$",
				"property": "isNumeric"
	        },
			{
				"object": "$",
				"property": "isPlainObject"
	        },
			{
				"object": "$",
				"property": "makeArray"
	        },
			{
				"object": "$",
				"property": "map",
				"message": "Use native es2015 map."
	        },
			{
				"object": "$",
				"property": "merge"
	        },
			{
				"object": "$",
				"property": "noop"
	        },
			{
				"object": "$",
				"property": "now"
	        },
			{
				"object": "$",
				"property": "parseJSON"
	        },
			{
				"object": "$",
				"property": "parseXML"
	        },
			{
				"object": "$",
				"property": "trim"
	        },
			{
				"object": "$",
				"property": "type"
	        },
			{
				"object": "$",
				"property": "proxy",
				"message": "Use native Function.bind."
	        },
			{
				"object": "$",
				"property": "when"
	        }
		],
        "no-return-assign": "error",
        "no-script-url": "error",
		"no-self-assign": "error",
        "no-self-compare": "error",
        "no-sequences": "error",
        "no-throw-literal": "error",
		"no-unmodified-loop-condition": "warn",
        "no-unused-expressions": "error",
		"no-unused-labels": "error",
        "no-useless-call": "error",
        "no-useless-concat": "warn",
		"no-useless-return": "warn",
        "no-void": "error",
        "no-warning-comments": "off",
        "no-with": "error",
        "radix": "error",
        "vars-on-top": "error",
        "wrap-iife": ["error", "outside"],
        "yoda": ["error", "never", {"exceptRange": true}],

        // Strict Mode
        "strict": ["error", "global"],

        // Variables
        "no-catch-shadow": "error",
        "no-delete-var": "error",
        "no-label-var": "error",
        "no-shadow-restricted-names": "error",
        "no-shadow": ["warn", {"builtinGlobals": false}],
        "no-undef": "error",
        "no-undef-init": "error",
        "no-undefined": "warn",
        "no-unused-vars": ["warn", {"vars": "all", "args": "after-used"}],
        "no-use-before-define": ["error", "nofunc"],

        // Node.js and CommonJS
        "global-require": "warn",
        "handle-callback-err": "off", // !!!
		"no-buffer-constructor": "warn",
        "no-new-require": "warn",
        "no-path-concat": "warn",

        // Stylistic Issues
		"array-bracket-newline": "off", // !!!
        "array-bracket-spacing": ["warn", "never"],
        "block-spacing": ["warn", "never"],
        "brace-style": ["warn", "1tbs"],
        "camelcase": "warn",
        "comma-spacing": ["warn", {"before": false, "after": true}],
        "comma-style": ["warn", "last"],
        "computed-property-spacing": ["warn", "never"],
        "consistent-this": ["warn", "that"],
        "eol-last": "warn",
		"func-call-spacing": ["warn", "never"],
        "func-names": "off",
        "func-style": "off",
		"id-blacklist": "off",
        "id-length": "off",
        "id-match": "off",
        "indent": ["warn", "tab", {"SwitchCase": 1}],
        "jsx-quotes": "off",
        "key-spacing": ["warn", {"beforeColon": false, "afterColon": true}],
		"keyword-spacing": ["error", {"before": true, "after": true, "overrides": {}}],
        "linebreak-style": "off",
        "lines-around-comment": "off",
        "max-depth": ["warn", 10],
        "max-len":  ["warn", 2000],
//		"max-lines": ["warn", 300], !!!
        "max-nested-callbacks": ["warn", 10],
        "max-params": ["warn", 10],
        "max-statements": ["warn", 150],
		"max-statements-per-line": ["warn", {"max": 2}],
        "new-cap": "warn",
        "new-parens": "warn",
		"newline-per-chained-call": "off",
        "no-array-constructor": "warn",
		"no-bitwise": "warn",
        "no-continue": "warn",
        "no-inline-comments": "off",
        "no-lonely-if": "off",
        "no-mixed-spaces-and-tabs": "warn",
        "no-multiple-empty-lines": "off",
		"no-multi-assign": "warn",
        "no-negated-condition": "off",
        "no-nested-ternary": "warn",
        "no-new-object": "warn",
		"no-plusplus": "off",
        "no-restricted-syntax": ["warn", "WithStatement"],
        "no-ternary": "off",
        "no-trailing-spaces": "warn",
        "no-underscore-dangle": "off",
        "no-unneeded-ternary": "warn",
		"no-whitespace-before-property": "off",
//		"object-curly-newline": ["warn", {"multiline": true}], !!!
        "object-curly-spacing": ["warn", "never"],
		"one-var-declaration-per-line": "off",
        "operator-assignment": "off",
        "operator-linebreak": ["warn", "after", {"overrides": {"?": "ignore", ":": "ignore"}}],
        "padded-blocks": "off",
		"padding-line-between-statements": ["warn",
			// require blank lines before all return statements
			//{"blankLine": "always", "prev": "*", "next": "return"},
			//  require blank lines after every sequence of variable declarations
//			{"blankLine": "always", "prev": ["const", "let", "var"], "next": "*"},
//			{"blankLine": "any",    "prev": ["const", "let", "var"], "next": ["const", "let", "var"]},
			//  switch/case
//			{"blankLine": "always", "prev": ["*"], "next": "case"},
//			{"blankLine": "any",    "prev": ["switch"], "next": ["case"]},
//			{"blankLine": "always", "prev": ["*"], "next": "default"},
//			{"blankLine": "any",    "prev": ["switch"], "next": ["default"]},
			// require blank lines after all directive prologues
			{"blankLine": "always", "prev": "directive", "next": "*"},
			{"blankLine": "any",    "prev": "directive", "next": "directive"}
		],
        "quote-props": ["warn", "consistent"],
        "quotes": ["warn", "single", "avoid-escape"],
        "require-jsdoc": "off",
        "semi": ["warn", "always"],
        "semi-spacing": ["warn", {"before": false, "after": true}],
		"semi-style": ["error", "last"],
		"sort-imports": "off",
        "sort-vars": "off",
        "space-before-blocks": "warn",
        "space-before-function-paren": ["warn", {"anonymous": "always", "named": "never"}],
        "spaced-comment": ["off", "always"],
		"switch-colon-spacing": ["error", {"after": true, "before": false}],
		"unicode-bom": ["error", "never"],
        "wrap-regex": "off",

        // ECMAScript 6
        "arrow-body-style": ["error", "as-needed"],
        "arrow-parens": ["warn", "always"],
        "arrow-spacing": ["warn", {"before": true, "after": true}],
        "constructor-super": "error",
        "generator-star-spacing": ["warn", {"before": true, "after": false}],
        "no-class-assign": "error",
        "no-confusing-arrow": "error",
        "no-const-assign": "error",
        "no-dupe-class-members": "error",
		"no-duplicate-imports":  "error",
        "no-new-symbol": "error",
        "no-this-before-super": "error",
        "no-useless-constructor": "error",
		"no-useless-computed-key": "warn",
		"no-useless-rename": "warn",
        "no-var": "error",
        "object-shorthand": "off",
        "prefer-arrow-callback": "off",
		"prefer-const": "warn",
        "prefer-reflect": "off",
        "prefer-rest-params": "off",
        "prefer-spread": "off",
        "prefer-template": "off",
        "require-yield": "error",
        "template-curly-spacing": "error",
        "yield-star-spacing": "error"
    }
}

What did you do? Please include the actual source code causing the issue.

...
const jd = json.data;

formObject.setValue(BEC.BLANKLINESBEFORE,<tabs>jd.blankLinesBefore);
formObject.setValue(BEC.BLANKLINESAFTER,<tabs>jd.blankLinesAfter);
formObject.setValue(BEC.BREAKBEFORE,<tabs>jd.pageBreakBefore);
formObject.setValue(BEC.BREAKAFTER,<tabs>jd.pageBreakAfter);
...

What did you expect to happen?
In previous versions to eslint 4.4.0 the above example did not report a warning when aligning the second arguments in the setValue function calls. In eslint 4.4.0 a warning is reported and I see no way to exclude this very common use case from being reported.

What actually happened? Please include the actual, raw output from ESLint.

warning: Multiple spaces found before 'jd' (no-multi-spaces) at src\modules\las_mod_positions\formHelper.js:654:47:
  652 |                 const jd = json.data;
  653 |
> 654 |                 formObject.setValue(BEC.BLANKLINESBEFORE,                       jd.blankLinesBefore);
      |                                                                                 ^
  655 |                 formObject.setValue(BEC.BLANKLINESAFTER,                        jd.blankLinesAfter);
  656 |                 formObject.setValue(BEC.BREAKBEFORE,                            jd.pageBreakBefore);
  657 |                 formObject.setValue(BEC.BREAKAFTER,                                     jd.pageBreakAfter);
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 6, 2017
@not-an-aardvark
Copy link
Member

not-an-aardvark commented Aug 6, 2017

Thanks for the report. I'm a bit confused by your example -- it seems to have a ^ character in the middle which is invalid syntax, and each individual line also gets reported by the rule when using ESLint v4.3.0.

The no-multi-spaces rule was refactored in v4.4.0, so it's plausible that something accidentally changed in this version, but I don't see that based on your example code.

@not-an-aardvark not-an-aardvark added bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Aug 6, 2017
@doberkofler
Copy link
Contributor Author

@not-an-aardvark The ^ character you mention is in the output of eslint and not in the source code and indicates where eslint found the offensive code. It is my understanding, that the no-multi-spaces rule in eslint 4.4.0 no longer allows multiple tabs when aligning the arguments in the function calls. This might be an intended change but no longer allows a very common pattern to format the source code.

@not-an-aardvark
Copy link
Member

not-an-aardvark commented Aug 7, 2017

To clarify, I meant the ^ character in the "Please include the actual source code" section, not the "output from ESLint" section. At the moment, it seems like your source code example only contains spaces and not tabs.

@doberkofler
Copy link
Contributor Author

@not-an-aardvark You are right and I overlooked my copy&paste error. I just updated the source and used <tabs> to indicate where the tabs are.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion regression Something broke and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 7, 2017
not-an-aardvark added a commit that referenced this issue Aug 7, 2017
An unintended side-effect of the refactor in 0f97279 caused `no-multi-spaces` to start reporting any consecutive whitespace characters between tokens, rather than just reporting consecutive spaces. This commit fixes the rule to only report consecutive spaces.
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly regression Something broke rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants