eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
25.14k stars 4.55k forks source link

Extremely slow on Jest tests #11077

Closed acierto closed 5 years ago

acierto commented 6 years ago

Tell us about your environment

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

Please show your full configuration:

import eslint from 'gulp-eslint';
import gulp from 'gulp';
import lesshint from 'xl-gulp-lesshint';
import paths from '../utils/paths';

const lesshintSteam = (stream) => stream
    .pipe(lesshint({maxWarnings: 0}))
    .pipe(lesshint.reporter())
    .pipe(lesshint.failOnError());

const lintStream = (stream) => stream
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());

gulp.task('lint-less', () => lesshintSteam(gulp.src(`${paths.webSrcDir}/**/*.less`)));

gulp.task('lint', () => lintStream(gulp.src(`${paths.webSrcDir}/**/*.js`)));

gulp.task('lint-tests', () => lintStream(gulp.src(`${paths.unitTestDir}/**/*.js`)));

gulp.task('build-lint', gulp.series('lint-less', 'coffee-lint'));

gulp.task('lint-all', gulp.series('lint-less', 'lint', 'coffee-lint', 'lint-tests'));
Configuration ```js { // http://eslint.org/docs/rules/ "parserOptions": { "ecmaVersion": 7, "sourceType": "module", "ecmaFeatures": { "arrowFunctions": true, "binaryLiterals": true, "blockBindings": true, "classes": true, "defaultParams": true, "destructuring": true, "forOf": true, "generators": true, "modules": true, "objectLiteralComputedProperties": true, "objectLiteralDuplicateProperties": true, "objectLiteralShorthandMethods": true, "objectLiteralShorthandProperties": true, "octalLiterals": true, "regexUFlag": true, "regexYFlag": true, "spread": true, "superInFunctions": true, "templateStrings": true, "unicodeCodePointEscapes": true, "globalReturn": true, "jsx": true, "legacyDecorators": true } }, "settings": { "react": { "pragma": "React", // Pragma to use, default to "React" "version": "15.0" // React version, default to the latest React stable release }, "import/extensions": [".js"], "import/resolve": { "extensions": [ ".js"] } }, "env": { "browser": false, // browser global variables "node": false, // Node.js global variables and Node.js-specific rules "amd": false, // defines require() and define() as global variables as per the amd spec "mocha": false, // adds all of the Mocha testing global variables "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0 "phantomjs": false, // phantomjs global variables "jquery": false, // jquery global variables "prototypejs": false, // prototypejs global variables "shelljs": false, // shelljs global variables "es6": true // enable all ECMAScript 6 features except for modules }, "globals": { "$": true, "Blob": true, "FormData": true, "ObjectObserver": true, "Promise": true, "_": true, "afterEach": true, "beforeEach": true, "browser": true, "console": true, "describe": true, "document": true, "expect": true, "fetch": true, "global": true, "it": true, "jasmine": true, "jest": true, "jsPlumb": true, "location": true, "mocha": true, "module": true, "moment": true, "process": true, "setTimeout": true, "window": true, "__resourceQuery": true }, "plugins": ["babel", "jest", "react", "import"], "parser": "babel-eslint", "rules": { ////////// Possible Errors ////////// "no-cond-assign": 2, // disallow assignment in conditional expressions "no-console": 2, // disallow use of console (off by default in the node environment) "no-constant-condition": 0, // disallow use of constant expressions in conditions "no-control-regex": 2, // disallow control characters in regular expressions "no-debugger": 2, // disallow use of debugger "no-dupe-args": 2, // disallow duplicate arguments in functions "no-dupe-keys": 2, // disallow duplicate keys when creating object literals "no-duplicate-case": 2, // disallow a duplicate case label "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions "no-empty": 2, // disallow empty statements "no-ex-assign": 2, // disallow assigning to the exception in a catch block "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context "no-extra-parens": ["error", "all"], // disallow unnecessary parentheses (off by default) "no-extra-semi": 2, // disallow unnecessary semicolons "no-func-assign": 2, // disallow overwriting functions written as function declarations "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions "no-prototype-builtins": 2, // disallow calling some Object.prototype methods directly on objects "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal "no-sparse-arrays": 2, // disallow sparse arrays "no-unexpected-multiline": 2, // Avoid code that looks like two expressions but is actually one (off by default) "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement "no-unsafe-finally": 2, // disallow control flow statements in finally blocks "use-isnan": 2, // disallow comparisons with the value NaN "valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default) "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string ////////// Best Practices ////////// "accessor-pairs": 0, // enforces getter/setter pairs in objects (off by default) "array-callback-return": 2, // enforce return statements in callbacks of array methods "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) "complexity": ["error", 3], // specify the maximum cyclomatic complexity allowed in a program (off by default) "consistent-return": 2, // require return statements to either always or never specify values "curly": 2, // specify curly brace conventions for all control statements "default-case": 2, // require default case in switch statements (off by default) "dot-location": [2, "property"], // enforces consistent newlines before or after dots (off by default) "dot-notation": 2, // encourages use of dot notation whenever possible "eqeqeq": 2, // require the use of === and !== "guard-for-in": 0, // make sure for-in loops have an if statement (off by default) "no-alert": 2, // disallow the use of alert, confirm, and prompt "no-caller": 2, // disallow use of arguments.caller or arguments.callee "no-case-declarations": 2, // disallow lexical declarations in case clauses "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default) "no-else-return": 2, // disallow else after a return in an if (off by default) "no-empty-function": 2, // disallow empty functions "no-empty-pattern": 2, // disallow empty destructuring patterns "no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default) "no-eval": 2, // disallow use of eval() "no-extend-native": 2, // disallow adding to native types "no-extra-bind": 2, // disallow unnecessary function binding "no-extra-label": 2, // disallow unnecessary labels "no-fallthrough": 2, // disallow fallthrough of case statements "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default) "no-implicit-coercion": 2, // disallow shorthand type conversions "no-implicit-globals": 2, // disallow var and named function declarations in the global scope "no-implied-eval": 2, // disallow use of eval()-like methods "no-invalid-this": 0, // disallow this keywords outside of classes or class-like objects "no-iterator": 2, // disallow usage of __iterator__ property "no-labels": 2, // disallow use of labeled statements "no-lone-blocks": 2, // disallow unnecessary nested blocks "no-loop-func": 2, // disallow creation of functions within loops "no-magic-numbers": 0, // disallow magic numbers "no-multi-spaces": 2, // disallow use of multiple spaces "no-multi-str": 2, // disallow use of multiline strings "no-native-reassign": 2, // disallow reassignments of native objects "no-new-func": 2, // disallow use of new operator for Function object "no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean "no-new": 2, // disallow use of new operator when not part of the assignment or comparison "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; "no-octal": 2, // disallow use of octal literals "no-param-reassign": 2, // disallow reassignment of function parameters (off by default) "no-proto": 2, // disallow usage of __proto__ property "no-redeclare": 2, // disallow declaring the same variable more then once "no-return-assign": 2, // disallow use of assignment in return statement "no-script-url": 2, // disallow use of javascript: urls "no-self-assign": 2, // disallow assignments where both sides are exactly the same "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default) "no-sequences": 2, // disallow use of comma operator "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default) "no-unmodified-loop-condition": 2, // disallow unmodified loop conditions "no-unused-expressions": 2, // disallow usage of expressions in statement position "no-unused-labels": 2, // disallow unused labels "no-useless-call": 2, // disallow unnecessary calls to .call() and .apply() "no-useless-concat": 2, // disallow unnecessary concatenation of literals or template literals "no-useless-escape": 2, // disallow unnecessary escape characters "no-void": 2, // disallow use of void operator (off by default) "no-warning-comments": 2, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default) "no-with": 2, // disallow use of the with statement "radix": 2, // require use of the second argument for parseInt() (off by default) "sort-keys": [2, "asc", {"caseSensitive": false, "natural": false}], "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default) "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default) "yoda": 2, // require or disallow Yoda conditions ////////// Strict Mode ////////// "strict": [2, "global"], // controls location of Use Strict Directives ////////// Variables ////////// "init-declarations": 0, // require or disallow initialization in var declarations "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) "no-delete-var": 2, // disallow deletion of variables "no-label-var": 2, // disallow labels that share a name with a variable "no-restricted-globals": 2, // disallow specified global variables "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments "no-shadow": 2, // disallow declaration of variables already declared in the outer scope "no-undef-init": 2, // disallow use of undefined when initializing variables "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block "no-undefined": 0, // disallow use of undefined variable (off by default) "no-unused-vars": 2, // disallow declaration of variables that are not used in the code "no-use-before-define": 2, // disallow use of variables before they are defined ////////// Node.js and CommonJs ////////// "callback-return": 2, // require return statements after callbacks "global-require": 2, // require require() calls to be placed at top-level module scope "handle-callback-err": 2, // enforces error handling in callbacks (off by default) (on by default in the node environment) "no-mixed-requires": 2, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) "no-new-require": 2, // disallow use of new operator with the require function (off by default) (on by default in the node environment) "no-path-concat": 2, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) "no-process-exit": 2, // disallow process.exit() (on by default in the node environment) "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) "no-sync": 0, // disallow use of synchronous methods (off by default) ////////// Stylistic Issues ////////// "array-bracket-spacing": 2, // enforce spacing inside array brackets (off by default) "block-spacing": 2, // enforce consistent spacing inside single-line blocks "brace-style": [2, "1tbs"], // enforce one true brace style (off by default) "camelcase": 2, // require camel case names "comma-dangle": 2, // disallow trailing commas in object literals "comma-spacing": [2, {"before": false, "after": true}], // enforce spacing before and after comma "comma-style": [2, "last"], // enforce one true comma style (off by default) "computed-property-spacing": [2, "never"], // require or disallow padding inside computed properties (off by default) "consistent-this": 2, // enforces consistent naming when capturing the current execution context (off by default) "eol-last": 2, // enforce newline at the end of file, with no multiple empty lines "func-names": [2, "never"], // require function expressions to have a name (off by default) "func-style": [2, "declaration", {"allowArrowFunctions": true}], // enforces use of function declarations or expressions (off by default) "id-blacklist": 0, // disallow specified identifiers "id-length": ["error", { "min": 2, "exceptions": ["_", "$", "Q", "R", "RU"] }], // enforce minimum and maximum identifier lengths "id-match": 0, // require identifiers to match a specified regular expression "indent": ["error", 4, {"SwitchCase": 1, "MemberExpression": 1}], // this option sets a specific tab width for your code (off by default) "jsx-quotes": [2, "prefer-double"], // enforce the consistent use of either double or single quotes in JSX attributes "key-spacing": 2, // enforces spacing between keys and values in object literal properties "keyword-spacing": 2, // enforce consistent spacing before and after keywords "linebreak-style": 0, // disallow mixed 'LF' and 'CRLF' as linebreaks (off by default) "lines-around-comment": [2, {"beforeBlockComment": false}], // enforces empty lines around comments (off by default) "max-depth": [2, {"max": 2}], // enforce a maximum depth that blocks can be nested "max-len": [2, {"code": 120}], // enforce a maximum line length "max-lines": [2, {"max": 300}], // enforce a maximum number of lines per file "max-nested-callbacks": 2, // specify the maximum depth callbacks can be nested (off by default) "max-params": 0, // enforce a maximum number of parameters in function definitions "max-statements-per-line": 2, // enforce a maximum number of statements allowed per line "max-statements": 0, // enforce a maximum number of statements allowed in function blocks "multiline-ternary": 0, // enforce newlines between operands of ternary expressions "new-cap": 2, // require a capital letter for constructors "new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) "newline-before-return": 0, // require an empty line before return statements "newline-per-chained-call": [2, {"ignoreChainWithDepth": 3}], // require a newline after each call in a method chain "no-array-constructor": 2, // disallow use of the Array constructor "no-bitwise": 2, // disallow bitwise operators "no-continue": 2, // disallow use of the continue statement (off by default) "no-inline-comments": 2, // disallow comments inline after code (off by default) "no-lonely-if": 2, // disallow if as the only statement in an else block (off by default) "no-mixed-operators": 0, // disallow mixed binary operators "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation "no-multiple-empty-lines": [2, {"max": 1}], // disallow multiple empty lines (off by default) "no-negated-condition": 0, // disallow negated conditions "no-nested-ternary": 2, // disallow nested ternary expressions (off by default) "no-new-object": 2, // disallow use of the Object constructor "no-plusplus": 2, // disallow the unary operators ++ and -- "no-restricted-syntax": 2, // disallow specified syntax "no-spaced-func": 2, // disallow space between function identifier and application "no-tabs": 0, // Disallow tabs in file "no-ternary": 0, // disallow the use of ternary operators (off by default) "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines "no-underscore-dangle": 0, // disallow dangling underscores in identifiers "no-unneeded-ternary": 2, // disallow ternary operators when simpler alternatives exist "no-whitespace-before-property": 2, // disallow whitespace before properties "object-curly-newline": [2, { "multiline": true, "minProperties": 5 }], // enforce consistent line breaks inside braces "object-curly-spacing": 2, // enforce consistent spacing inside braces "object-property-newline": [2, { "allowMultiplePropertiesPerLine": true }], // enforce placing object properties on separate lines "one-var-declaration-per-line": 2, // require or disallow newlines around var declarations "one-var": 0, // allow just one var statement per function (off by default) "operator-assignment": 2, // require assignment operator shorthand where possible or prohibit it entirely (off by default) "operator-linebreak": [2, "after"], // enforce operators to be placed before or after line breaks (off by default) "padded-blocks": [2, "never"], // enforce padding within blocks (off by default) "quote-props": [2, "consistent-as-needed"], // require quotes around object literal property names (off by default) "quotes": [2, "single", "avoid-escape"], // specify whether double or single quotes should be used "require-jsdoc": 0, // require JSDoc comments "semi-spacing": 2, // enforce spacing before and after semicolons "semi": 2, // require or disallow use of semicolons instead of ASI "sort-vars": 0, // sort variables within the same declaration block (off by default) "space-before-blocks": 2, // require or disallow space before blocks (off by default) "space-before-function-paren": ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}], // require or disallow space before function opening parenthesis (off by default) "space-in-parens": [2, "never"], // require or disallow spaces inside parentheses (off by default) "space-infix-ops": 2, // require spaces around operators "space-unary-ops": 2, // require or disallow spaces before/after unary operators (words on by default, nonwords off by default) "spaced-comment": 2, // require or disallow a space immediately following the // or /* in a comment (off by default) "unicode-bom": 2, // require or disallow Unicode byte order mark (BOM) "wrap-regex": 2, // require regex literals to be wrapped in parentheses (off by default) ////////// ECMAScript 6 ////////// "arrow-body-style": [2, "as-needed"], // require braces around arrow function bodies "arrow-parens": ["error", "always"], // Require parens in arrow function arguments "arrow-spacing": 2, // enforce consistent spacing before and after the arrow in arrow functions "constructor-super": 0, // verify super() callings in constructors (off by default) "generator-star-spacing": ["error", {"before": false, "after": true}], // enforce the spacing around the * in generator functions (off by default) "no-class-assign": 2, // disallow reassigning class members "no-confusing-arrow": 0, // disallow arrow functions where they could be confused with comparisons "no-const-assign": 2, // disallow reassigning const variables "no-dupe-class-members": 2, // disallow duplicate class members "no-duplicate-imports": 2, // disallow duplicate module imports "no-new-symbol": 2, // disallow new operators with the Symbol object "no-restricted-imports": 2, // disallow specified modules when loaded by import "no-this-before-super": 2, // disallow to use this/super before super() calling in constructors (off by default) "no-useless-computed-key": 2, // disallow unnecessary computed property keys in object literals "no-useless-constructor": 2, // disallow unnecessary constructors "no-useless-rename": 2, // disallow renaming import, export, and destructured assignments to the same name "no-var": 2, // require let or const instead of var (off by default) "object-shorthand": 0, // require method and property shorthand syntax for object literals (off by default) "prefer-arrow-callback": 2, // require arrow functions as callbacks "prefer-const": 2, // suggest using of const declaration for variables that are never modified after declared (off by default) "prefer-rest-params": 2, // require rest parameters instead of arguments "prefer-spread": 2, // require spread operators instead of .apply() "prefer-template": 2, // require template literals instead of string concatenation "require-yield": 2, // require generator functions to contain yield "rest-spread-spacing": 2, // enforce spacing between rest and spread operators and their expressions "sort-imports": 0, // enforce sorted import declarations within modules "template-curly-spacing": 2, // require or disallow spacing around embedded expressions of template strings "yield-star-spacing": [2, "after"], // require or disallow spacing around the * in yield* expressions ////////// React /////////// // Supported rules "react/display-name": 0, // Prevent missing displayName in a React component definition "react/forbid-component-props": 0, // Forbid certain props on Components "react/forbid-prop-types": [2, {"forbid": ["any"]}], // Forbid certain propTypes "react/no-array-index-key": 2, // Prevent usage of Array index in keys "react/no-children-prop": 2, // Prevent passing of children as props "react/no-danger": 2, // Prevent usage of dangerous JSX properties "react/no-danger-with-children": 2, // Prevent problem with children and props.dangerouslySetInnerHTML "react/no-deprecated": 2, // Prevent usage of deprecated methods "react/no-did-mount-set-state": [2, "disallow-in-func"], // Prevent usage of setState in componentDidMount "react/no-did-update-set-state": [2, "disallow-in-func"], // Prevent usage of setState in componentDidUpdate "react/no-direct-mutation-state": 2, // Prevent direct mutation of this.state "react/no-find-dom-node": 2, // Prevent usage of findDOMNode "react/no-is-mounted": 2, // Prevent usage of isMounted "react/no-multi-comp": 0, // Prevent multiple component definition per file "react/no-render-return-value": 2, // Prevent usage of the return value of React.render "react/no-set-state": 0, // Prevent usage of setState "react/no-string-refs": 2, // Prevent using string references in ref attribute "react/no-unescaped-entities": 2, // Prevent invalid characters from appearing in markup "react/no-unknown-property": 2, // Prevent usage of unknown DOM property "react/no-unused-prop-types": 0, // Prevent definitions of unused prop types "react/prefer-es6-class": 2, // Enforce ES5 or ES6 class for React Components "react/prefer-stateless-function": 0, // Enforce stateless React Components to be written as a pure function "react/prop-types": 2, // Prevent missing props validation in a React component definition "react/react-in-jsx-scope": 2, // Prevent missing React when using JSX "react/require-default-props": 0, // Enforce a defaultProps definition for every prop that is not a required prop "react/require-optimization": 0, // Enforce React components to have a shouldComponentUpdate method "react/require-render-return": 2, // Enforce ES5 or ES6 class for returning value in render function "react/self-closing-comp": 2, // Prevent extra closing tags for components without children "react/sort-comp": [2, { "order": [ "propTypes", "defaultProps", "static-methods", "statics", "constructor", "state", "componentWillMount", "componentDidMount", "componentWillReceiveProps", "shouldComponentUpdate", "componentWillUpdate", "componentDidUpdate", "componentWillUnmount", "/^handle.+$/", "/^on.+$/", "everything-else", "/^render.+$/", "render" ] }], // Enforce component methods order "react/sort-prop-types": [2, {"ignoreCase": true}], // Enforce propTypes declarations alphabetical sorting "react/style-prop-object": 2, // Enforce propTypes declarations alphabetical sorting // JSX "react/jsx-boolean-value": [2, "always"], // Enforce boolean attributes notation in JSX "react/jsx-closing-bracket-location": [2, {"selfClosing": "line-aligned", "nonEmpty": "after-props"}], // Validate closing bracket location in JSX "react/jsx-curly-spacing": 2, // Enforce or disallow spaces inside of curly braces in JSX attributes "react/jsx-equals-spacing": 2, // Enforce or disallow spaces around equal signs in JSX attributes "react/jsx-filename-extension": 0, // Restrict file extensions that may contain JSX "react/jsx-first-prop-new-line": [2, "multiline-multiprop"], // Enforce position of the first prop in JSX "react/jsx-handler-names": 2, // Enforce event handler naming conventions in JSX "react/jsx-indent": 2, // Validate JSX indentation "react/jsx-indent-props": 0, // Validate props indentation in JSX "react/jsx-key": 2, // Validate JSX has key prop when in array or iterator "react/jsx-max-props-per-line": [2, {"maximum": 3, "when": "multiline"}], // Enforce position of the first prop in JSX "react/jsx-no-bind": 0, // Prevent usage of .bind() and arrow functions in JSX props "react/jsx-no-comment-textnodes": 2, // Prevent comments from being inserted as text nodes "react/jsx-no-duplicate-props": 2, // Prevent duplicate props in JSX "react/jsx-no-literals": 0, // Prevent usage of unwrapped JSX strings "react/jsx-no-target-blank": 2, // Prevent usage of unsafe target='_blank' "react/jsx-no-undef": 2, // Disallow undeclared variables in JSX "react/jsx-pascal-case": 2, // Enforce PascalCase for user-defined JSX components "react/jsx-sort-props": 2, // Enforce props alphabetical sorting "react/jsx-tag-spacing": [2, { "closingSlash": "never", "beforeSelfClosing": "never", "afterOpening": "never" }], // Validate whitespace in and around the JSX opening and closing brackets "react/jsx-uses-react": 2, // Prevent React to be incorrectly marked as unused "react/jsx-uses-vars": 2, // Prevent variables used in JSX to be incorrectly marked as unused "react/no-will-update-set-state": 0, // Prevent usage of setState in componentWillUpdate "jsx-wrap-multilines": 0, // Prevent missing parentheses around multiline JSX ////////// Import plugin /////////// // Static analysis "import/no-unresolved": [2, { "ignore": ["^[~]"] }], // Ensure imports point to a file/module that can be resolved "import/named": 2, // Ensure named imports correspond to a named export in the remote file "import/default": 0, // Ensure a default export is present, given a default import "import/namespace": 2, // Ensure imported namespaces contain dereferenced properties as they are dereferenced "import/no-restricted-paths": 2, // Restrict which files can be imported in a given folder "import/no-absolute-path": 2, // Forbid import of modules using absolute paths "import/no-dynamic-require": 2, // Forbid require() calls with expressions "import/no-internal-modules": 0, // Use this rule to prevent importing the submodules of other modules "import/no-webpack-loader-syntax": 2, // Forbid Webpack loader syntax in imports // Helpful warnings "import/export": 2, // Report any invalid exports, i.e. re-export of the same name "import/no-named-as-default": 2, // Report use of exported name as identifier of default export "import/no-named-as-default-member": 2, // Report use of exported name as property of default export "import/no-deprecated": 2, // Report imported names marked with @deprecated documentation tag "import/no-extraneous-dependencies": 2, // Forbid the use of extraneous packages "import/no-mutable-exports": 2, // Forbid the use of mutable exports with var or let // Module systems "import/unambiguous": 0, // Warn if a module could be mistakenly parsed as a script by a consumer leveraging Unambiguous JavaScript Grammar to determine correct parsing goal. "import/no-commonjs": 2, // Report CommonJS require calls and module.exports or exports.* "import/no-amd": 2, // Report AMD require and define calls "import/no-nodejs-modules": 2, // No Node.js builtin modules // Style guide "import/first": 2, // Ensure all imports appear before other statements "import/no-duplicates": 2, // Report repeated import of the same module in multiple places "import/no-namespace": 0, // Report namespace imports "import/extensions": [2, "never", { "json": "always", "svg": "always" }], // Ensure consistent use of file extension within the import path "import/order": 2, // Enforce a convention in module import order "import/newline-after-import": 2, // Enforce a newline after import statements "import/prefer-default-export": 0, // Prefer a default export if module exports a single name "import/max-dependencies": 0, // Forbid modules to have too many dependencies (import or require statements). "import/no-unassigned-import": 0, // With both CommonJS' require and the ES6 modules' import syntax, it is possible to import a module but not to use its result. This can be done explicitly by not assigning the module to as variable. "import/no-named-default": 0, // Reports use of a default export as a locally named import. // Jest "jest/no-disabled-tests": "warn", "jest/no-focused-tests": "error", "jest/no-identical-title": "error", "jest/prefer-to-have-length": "warn", "jest/valid-expect": "error" } } ```

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

See above gulp config

What did you expect to happen?

I expect to have executing time on tests is not longer that is happening for source code. Source code is much bigger than test code, but parsing tests takes 10 times more time.

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

screen shot 2018-11-12 at 07 27 46

Are you willing to submit a pull request to fix this bug?

No, I didn't investigate the ESLint source code.

nzakas commented 6 years ago

Thanks for the report. Is this slower than a previous version of ESLint in any way?

Just a note: we aren't involved in gulp-eslint and so can't help you there. It's worth trying to run ESLint directly to see what the time difference is to see whether the problem is ESLint itself or glup-eslint, or something in between.

acierto commented 6 years ago

Sorry, I can't run the same in the pure eslint due to used plugins, which refuse to work, as eslint is too new for them "plugins": ["babel", "react", "import"] Don't think that gulp-eslint affects eslint anyhow, as it just stream data, you can check the code - there is only 1 small file to see what is happening inside. Moreover that same rules are applied for sources and tests, no difference there.

const lintStream = (stream) => stream
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());

gulp.task('lint', () => lintStream(gulp.src(`${paths.webSrcDir}/**/*.js`)));
gulp.task('lint-tests', () => lintStream(gulp.src(`${paths.unitTestDir}/**/*.js`)));

Such a feeling that some Jest constructions make eslint or one of those eslint plugins go to a panic :) I'll try to investigate more in-depth in near future and come back with my results :)

nzakas commented 6 years ago

Okay, thanks. You may want to file an issue with Jest as well to see if they have any insights.

On Mon, Nov 12, 2018 at 10:15 PM Bogdan Nechyporenko < notifications@github.com> wrote:

Sorry, I can't run the same in the pure eslint due to used plugins, which refuse to work, as eslint is too new for them "plugins": ["babel", "react", "import"] Don't think that gulp-eslint affects eslint anyhow, as it just stream data, you can check the code - there is only 1 small file to see what is happening inside. Moreover that same rules are applied for sources and tests, no difference there.

const lintStream = (stream) => stream .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError());

gulp.task('lint', () => lintStream(gulp.src(${paths.webSrcDir}/**/*.js))); gulp.task('lint-tests', () => lintStream(gulp.src(${paths.unitTestDir}/**/*.js)));

Such a feeling that some Jest constructions make eslint or one of those eslint plugins go to a panic :) I'll try to investigate more in-depth in near future and come back with my results :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eslint/eslint/issues/11077#issuecomment-438150258, or mute the thread https://github.com/notifications/unsubscribe-auth/AACWkjT03shukl6I86SgQxuFbFObIKz2ks5uumOTgaJpZM4YZCeU .

--


Nicholas C. Zakas @slicknet

Author, Principles of Object-Oriented JavaScript http://amzn.to/29Pmfrm Author, Understanding ECMAScript 6 http://amzn.to/29K1mIy

nzakas commented 5 years ago

Closing, as we believe this needs to be evaluating by the Jest team.