Skip to content

CR - max-len: {ignoreRegExpLiterals: true} is too permissive #9059

@refack

Description

@refack

Tell us about your environment

  • ESLint Version: 4.3.0
  • Node Version: master
  • npm Version: 5.3.0

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

Please show your full configuration:
https://github.com/nodejs/node/blob/master/.eslintrc.yaml
https://github.com/nodejs/node/blob/master/lib/.eslintrc.yaml

max-len: [error, {code: 80,
                  ignoreRegExpLiterals: true,
                  ignoreUrls: true,
                  tabWidth: 2}]

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

01: function fatalError(e) {
02:   if (typeof e.stack === 'string') {
03:     process._rawDebug(e.stack);
04:   } else {
05:     const o = { message: e };
06:     Error.captureStackTrace(o, fatalError);
07:     process._rawDebug(o.stack);
08:   }
09:  if (process.execArgv.some((e) => /^--abort[_-]on[_-]uncaught[_-]exception$/.test(e))) {
10:    process.abort();
11:   }
12:   process.exit(1);
13: }

What did you expect to happen?
L09 should error.
Even though we have ignoreRegExpLiterals: true such cases should not be allowed. It's not the RegExp that is super long, it's the multiple expressions in that single line that caused it to be too long.
I understand it's not a straightforward problem to solve, but IMHO it could be minimized with some heuristics.

What actually happened? Please include the actual, raw output from ESLint.
Nothing (i.e. lint passed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussionbreakingThis change is backwards-incompatibleenhancementThis change enhances an existing feature of ESLintevaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusionruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions