eslint / eslint

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

Error arfter upgrade 7.11.0 ->7.12.0 " The "path" argument must be of type string. Received undefined" #13789

Closed exodus4d closed 3 years ago

exodus4d commented 3 years ago

Tell us about your environment

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using? "parser": "@typescript-eslint/parser" Please show your full configuration:

Configuration `.eslintrc.json` ```json { "env": { "browser": true, "es6": true, "es2021": true, "amd": true, "node": true }, "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended" ], "globals": {}, "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 2020, "sourceType": "module", "ecmaFeatures": { "impliedStrict": true }, "project": "./tsconfig.eslint.json", "extraFileExtensions": [".mjs", ".d.ts", ".json"] }, "plugins": [ "@typescript-eslint", "import", "jsdoc", "json" ], "reportUnusedDisableDirectives": true, "root": true, "rules": { "for-direction": "error", "getter-return": [ "error", { "allowImplicit": true } ], "no-async-promise-executor": "error", "no-await-in-loop": "error", "no-compare-neg-zero": "error", "no-cond-assign": [ "error", "always" ], "no-console": [ "error", { "allow": ["ok", "pf", "brand", "info", "warn", "error", "debug", "group", "groupCollapsed", "groupEnd", "table"] } ], "no-constant-condition": "warn", "no-control-regex": "error", "no-debugger": "error", "no-dupe-args": "error", "no-dupe-else-if": "off", "no-dupe-keys": "error", "no-duplicate-case": "error", "no-empty": "error", "no-empty-character-class": "error", "no-ex-assign": "error", "no-extra-boolean-cast": "error", "no-func-assign": "error", "no-import-assign": "off", "no-inner-declarations": "error", "no-invalid-regexp": "error", "no-irregular-whitespace": "error", "no-misleading-character-class": "error", "no-obj-calls": "error", "no-promise-executor-return": "off", "no-prototype-builtins": "error", "no-regex-spaces": "error", "no-setter-return": "off", "no-sparse-arrays": "error", "no-template-curly-in-string": "error", "no-unexpected-multiline": "error", "no-unreachable": "error", "no-unreachable-loop": [ "off", { "ignore": [] } ], "no-unsafe-finally": "error", "no-unsafe-negation": "error", "no-useless-backreference": "off", "require-atomic-updates": "off", "use-isnan": "error", "valid-typeof": [ "error", { "requireStringLiterals": true } ], "accessor-pairs": "off", "array-callback-return": [ "error", { "allowImplicit": true } ], "block-scoped-var": "error", "class-methods-use-this": [ "error", { "exceptMethods": [] } ], "complexity": [ "off", 11 ], "consistent-return": "off", "curly": ["error", "multi-line"], "default-case": [ "error", { "commentPattern": "^no default$" } ], "default-case-last": "off", "dot-location": ["error", "property"], "eqeqeq": [ "error", "always", { "null": "ignore" } ], "grouped-accessor-pairs": "off", "guard-for-in": "error", "max-classes-per-file": ["error", 1], "no-alert": "warn", "no-caller": "error", "no-case-declarations": "error", "no-constructor-return": "off", "no-div-regex": "off", "no-else-return": [ "error", { "allowElseIf": false } ], "no-empty-pattern": "error", "no-eq-null": "off", "no-eval": "error", "no-extend-native": "error", "no-extra-bind": "error", "no-extra-label": "error", "no-fallthrough": "error", "no-floating-decimal": "error", "no-global-assign": [ "error", { "exceptions": [] } ], "no-implicit-coercion": [ "off", { "boolean": false, "number": true, "string": true, "allow": [] } ], "no-implicit-globals": "off", "no-implied-eval": "error", "no-iterator": "error", "no-labels": [ "error", { "allowLoop": false, "allowSwitch": false } ], "no-lone-blocks": "error", "no-loop-func": "error", "no-multi-spaces": [ "error", { "ignoreEOLComments": true, "exceptions": { "VariableDeclarator": true, "ImportDeclaration": true } } ], "no-multi-str": "error", "no-new": "error", "no-new-func": "error", "no-new-wrappers": "error", "no-octal": "error", "no-octal-escape": "error", "no-param-reassign": [ "warn", { "props": false } ], "no-proto": "error", "no-restricted-properties": [ "error", { "property": "__defineGetter__", "message": "Please use Object.defineProperty instead." }, { "property": "__defineSetter__", "message": "Please use Object.defineProperty instead." }, { "object": "global", "property": "isFinite", "message": "Please use Number.isFinite instead" }, { "object": "global", "property": "isNaN", "message": "Please use Number.isNaN instead" }, { "object": "window", "property": "isFinite", "message": "Please use Number.isFinite instead" }, { "object": "window", "property": "isNaN", "message": "Please use Number.isNaN instead" }, { "object": "self", "property": "isFinite", "message": "Please use Number.isFinite instead" }, { "object": "self", "property": "isNaN", "message": "Please use Number.isNaN instead" }, { "object": "arguments", "property": "callee", "message": "arguments.callee is deprecated" }, { "object": "Math", "property": "pow", "message": "Use the exponentiation operator (**) instead." } ], "no-return-assign": ["error", "except-parens"], "no-script-url": "error", "no-self-assign": [ "error", { "props": true } ], "no-self-compare": "error", "no-sequences": "error", "no-throw-literal": "error", "no-unmodified-loop-condition": "off", "no-unused-labels": "error", "no-useless-call": "off", "no-useless-catch": "error", "no-useless-concat": "error", "no-useless-escape": "error", "no-useless-return": "error", "no-void": "error", "no-warning-comments": [ "off", { "terms": ["todo", "fixme", "xxx"], "location": "start" } ], "no-with": "error", "prefer-promise-reject-errors": [ "off", { "allowEmptyReject": true } ], "prefer-named-capture-group": "off", "prefer-regex-literals": "off", "radix": "error", "require-unicode-regexp": "off", "vars-on-top": "error", "wrap-iife": [ "error", "outside", { "functionPrototypeMethods": false } ], "yoda": "error", "strict": ["error", "never"], "no-delete-var": "error", "no-label-var": "error", "no-restricted-globals": [ "error", "isFinite", "isNaN", "addEventListener", "blur", "close", "closed", "confirm", "defaultStatus", "defaultstatus", "event", "external", "find", "focus", "frameElement", "frames", "history", "innerHeight", "innerWidth", "length", "location", "locationbar", "menubar", "moveBy", "moveTo", "name", "onblur", "onerror", "onfocus", "onload", "onresize", "onunload", "open", "opener", "opera", "outerHeight", "outerWidth", "pageXOffset", "pageYOffset", "parent", "print", "removeEventListener", "resizeBy", "resizeTo", "screen", "screenLeft", "screenTop", "screenX", "screenY", "scroll", "scrollbars", "scrollBy", "scrollTo", "scrollX", "scrollY", "self", "status", "statusbar", "stop", "toolbar", "top" ], "no-shadow-restricted-names": "error", "no-undef": [ "error", { "typeof": false } ], "no-undef-init": "error", "no-undefined": "off", "array-bracket-newline": [ "off", "consistent" ], "array-bracket-spacing": [ "error", "never" ], "array-element-newline": [ "off", { "multiline": true, "minItems": 3 } ], "block-spacing": [ "error", "always" ], "camelcase": [ "error", { "properties": "never", "ignoreDestructuring": false } ], "capitalized-comments": [ "off", "never", { "line": { "ignorePattern": ".*", "ignoreInlineComments": true, "ignoreConsecutiveComments": true }, "block": { "ignorePattern": ".*", "ignoreInlineComments": true, "ignoreConsecutiveComments": true } } ], "comma-dangle": [ "error", "never" ], "comma-style": [ "error", "last", { "exceptions": { "ArrayExpression": false, "ArrayPattern": false, "ArrowFunctionExpression": false, "CallExpression": false, "FunctionDeclaration": false, "FunctionExpression": false, "ImportDeclaration": false, "ObjectExpression": false, "ObjectPattern": false, "VariableDeclaration": false, "NewExpression": false } } ], "computed-property-spacing": [ "error", "never" ], "consistent-this": "off", "eol-last": "off", "func-name-matching": [ "off", "always", { "includeCommonJSModuleExports": false, "considerPropertyDescriptor": true } ], "func-names": [ "error", "as-needed", { "generators": "as-needed" } ], "func-style": [ "off", "expression" ], "function-call-argument-newline": [ "off", "consistent" ], "function-paren-newline": [ "error", "consistent" ], "id-blacklist": "off", "id-denylist": "off", "id-length": "off", "id-match": "off", "implicit-arrow-linebreak": [ "error", "beside" ], "jsx-quotes": [ "off", "prefer-single" ], "key-spacing": [ "error", { "singleLine": { "beforeColon": false, "afterColon": true, "mode": "strict" }, "multiLine": { "beforeColon": false, "afterColon": true, "mode": "strict", "align": "value" } } ], "line-comment-position": [ "off", { "position": "above", "ignorePattern": "", "applyDefaultPatterns": true } ], "linebreak-style": [ "error", "unix" ], "lines-around-comment": "off", "lines-around-directive": [ "error", { "before": "always", "after": "always" } ], "max-depth": [ "off", 4 ], "max-len": [ "error", { "code": 140, "tabWidth": 4, "comments": 200, "ignoreUrls": true, "ignoreComments": false, "ignoreTrailingComments": true, "ignoreRegExpLiterals": true, "ignoreStrings": true, "ignoreTemplateLiterals": true } ], "max-lines": [ "off", { "max": 300, "skipBlankLines": true, "skipComments": true } ], "max-lines-per-function": [ "off", { "max": 50, "skipBlankLines": true, "skipComments": true, "IIFEs": true } ], "max-nested-callbacks": "off", "max-params": [ "off", 3 ], "max-statements": [ "off", 10 ], "max-statements-per-line": [ "off", { "max": 1 } ], "multiline-comment-style": [ "off", "starred-block" ], "multiline-ternary": [ "off", "never" ], "new-cap": [ "error", { "newIsCap": true, "newIsCapExceptions": [], "capIsNew": false, "capIsNewExceptions": [ "Immutable.Map", "Immutable.Set", "Immutable.List" ] } ], "new-parens": "error", "newline-after-var": "off", "newline-before-return": "off", "newline-per-chained-call": [ "error", { "ignoreChainWithDepth": 4 } ], "no-bitwise": "error", "no-continue": "error", "no-inline-comments": "off", "no-lonely-if": "error", "no-mixed-operators": [ "error", { "groups": [ [ "%", "**" ], [ "%", "+" ], [ "%", "-" ], [ "%", "*" ], [ "%", "/" ], [ "/", "*" ], [ "&", "|", "<<", ">>", ">>>" ], [ "==", "!=", "===", "!==" ], [ "&&", "||" ] ], "allowSamePrecedence": true } ], "no-mixed-spaces-and-tabs": "error", "no-multi-assign": [ "error" ], "no-multiple-empty-lines": [ "error", { "max": 2, "maxBOF": 0, "maxEOF": 0 } ], "no-negated-condition": "off", "no-nested-ternary": "off", "no-new-object": "error", "no-plusplus": "off", "no-restricted-syntax": [ "error", { "selector": "LabeledStatement", "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand." }, { "selector": "WithStatement", "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." } ], "no-spaced-func": "error", "no-tabs": "error", "no-ternary": "off", "no-trailing-spaces": [ "error", { "skipBlankLines": false, "ignoreComments": false } ], "no-underscore-dangle": [ "error", { "allowAfterThis": true, "allowAfterSuper": false, "allowAfterThisConstructor": false, "enforceInMethodNames": false, "allowFunctionParams": false } ], "no-unneeded-ternary": [ "error", { "defaultAssignment": false } ], "no-whitespace-before-property": "error", "nonblock-statement-body-position": [ "error", "beside", { "overrides": { "while": "below" } } ], "object-curly-newline": [ "error", { "ObjectExpression": { "minProperties": 5, "multiline": true, "consistent": true }, "ObjectPattern": { "minProperties": 5, "multiline": true, "consistent": true }, "ImportDeclaration": { "minProperties": 5, "multiline": true, "consistent": true }, "ExportDeclaration": { "minProperties": 5, "multiline": true, "consistent": true } } ], "object-curly-spacing": [ "error", "never" ], "object-property-newline": [ "error", { "allowAllPropertiesOnSameLine": true } ], "one-var": [ "error", "never" ], "one-var-declaration-per-line": [ "error", "always" ], "operator-assignment": [ "error", "always" ], "operator-linebreak": [ "error", "after", { "overrides": { "=": "none" } } ], "padded-blocks": [ "error", { "classes": "always", "blocks": "never", "switches": "never" }, { "allowSingleLineBlocks": true } ], "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "class", "next": "*" }, { "blankLine": "never", "prev": "return", "next": "block" } ], "prefer-exponentiation-operator": "off", "prefer-object-spread": "warn", "quote-props": [ "error", "as-needed", { "keywords": false, "unnecessary": true, "numbers": false } ], "require-jsdoc": "off", "semi-spacing": [ "error", { "before": false, "after": true } ], "semi-style": [ "error", "last" ], "sort-keys": [ "off", "asc", { "caseSensitive": false, "natural": true } ], "sort-vars": "off", "space-before-blocks": "error", "space-in-parens": [ "error", "never" ], "space-infix-ops": "error", "space-unary-ops": [ "error", { "words": true, "nonwords": false, "overrides": {} } ], "spaced-comment": [ "error", "always", { "line": { "exceptions": [ "-", "+" ], "markers": [ "=", "!", "/" ] }, "block": { "exceptions": [ "-", "+" ], "markers": [ "=", "!", ":", "::" ], "balanced": true } } ], "switch-colon-spacing": [ "error", { "after": true, "before": false } ], "template-tag-spacing": [ "error", "never" ], "unicode-bom": [ "error", "never" ], "wrap-regex": "off", "arrow-body-style": "off", "arrow-spacing": [ "error", { "before": true, "after": true } ], "arrow-parens": "off", "constructor-super": "error", "generator-star-spacing": [ "error", { "before": false, "after": true } ], "no-class-assign": "error", "no-confusing-arrow": [ "error", { "allowParens": true } ], "no-const-assign": "error", "no-new-symbol": "error", "no-restricted-exports": [ "off", { "restrictedNamedExports": [ "default", "then" ] } ], "no-restricted-imports": [ "off", { "paths": [], "patterns": [] } ], "no-this-before-super": "error", "no-useless-computed-key": "error", "no-useless-rename": [ "error", { "ignoreDestructuring": false, "ignoreImport": false, "ignoreExport": false } ], "no-var": "error", "object-shorthand": [ "error", "always", { "ignoreConstructors": false, "avoidQuotes": true } ], "prefer-arrow-callback": [ "error", { "allowNamedFunctions": false, "allowUnboundThis": true } ], "prefer-const": [ "error", { "destructuring": "any", "ignoreReadBeforeAssign": true } ], "prefer-destructuring": [ "error", { "VariableDeclarator": { "array": false, "object": true }, "AssignmentExpression": { "array": true, "object": false } }, { "enforceForRenamedProperties": false } ], "prefer-numeric-literals": "error", "prefer-rest-params": "error", "prefer-spread": "error", "prefer-template": "error", "require-yield": "error", "rest-spread-spacing": ["error", "never"], "sort-imports": [ "off", { "ignoreCase": false, "ignoreDeclarationSort": false, "ignoreMemberSort": false, "memberSyntaxSortOrder": ["none", "all", "multiple", "single"] } ], "symbol-description": "error", "template-curly-spacing": "error", "yield-star-spacing": ["error", "after"], "brace-style": "off", "@typescript-eslint/brace-style": [ "error", "1tbs", { "allowSingleLine": true } ], "comma-spacing": "off", "@typescript-eslint/comma-spacing": [ "error", { "before": false, "after": true } ], "default-param-last": "off", "@typescript-eslint/default-param-last": ["error"], "dot-notation": "off", "@typescript-eslint/dot-notation": [ "error", { "allowKeywords": true } ], "func-call-spacing": "off", "@typescript-eslint/func-call-spacing": ["error", "never"], "indent": "off", "@typescript-eslint/indent": [ "error", 4, { "ArrayExpression": 1, "CallExpression": { "arguments": 1 }, "FunctionDeclaration": { "parameters": 1, "body": 1 }, "FunctionExpression": { "parameters": 1, "body": 1 }, "ImportDeclaration": 1, "ObjectExpression": 1, "SwitchCase": 1, "VariableDeclarator": { "var": 2, "let": 2, "const": 3 }, "flatTernaryExpressions": false, "ignoreComments": false, "ignoredNodes": [], "outerIIFEBody": 1 } ], "init-declarations": "off", "@typescript-eslint/init-declarations": ["off"], "keyword-spacing": "off", "@typescript-eslint/keyword-spacing": [ "error", { "before": true, "after": true, "overrides": { "return": { "after": true }, "throw": { "after": true }, "case": { "after": true } } } ], "lines-between-class-members": "off", "@typescript-eslint/lines-between-class-members": [ "error", "always", { "exceptAfterSingleLine": false } ], "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": ["off"], "no-dupe-class-members": "off", "@typescript-eslint/no-dupe-class-members": ["error"], "no-duplicate-imports": "off", "@typescript-eslint/no-duplicate-imports": ["error"], "no-empty-function": "off", "@typescript-eslint/no-empty-function": [ "error", { "allow": ["arrowFunctions", "functions", "methods"] } ], "no-extra-parens": "off", "@typescript-eslint/no-extra-parens": [ "off", "all", { "conditionalAssign": true, "nestedBinaryExpressions": true, "returnAssign": false, "enforceForArrowConditionals": false } ], "no-extra-semi": "off", "@typescript-eslint/no-extra-semi": ["error"], "no-invalid-this": "off", "@typescript-eslint/no-invalid-this": ["error"], "no-loss-of-precision": "off", "@typescript-eslint/no-loss-of-precision": ["error"], "no-magic-numbers": "off", "@typescript-eslint/no-magic-numbers": [ "off", { "ignore": [], "ignoreArrayIndexes": true, "enforceConst": true, "detectObjects": false } ], "no-redeclare": "off", "@typescript-eslint/no-redeclare": ["error"], "no-shadow": "off", "@typescript-eslint/no-shadow": ["off", { "builtinGlobals": true, "hoist": "never", "ignoreTypeValueShadow": false, "ignoreFunctionTypeParameterNameValueShadow": false }], "no-unused-expressions": "off", "@typescript-eslint/no-unused-expressions": [ "error", { "allowShortCircuit": false, "allowTernary": false, "allowTaggedTemplates": false } ], "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": true, "argsIgnorePattern": "[iI]gnored" } ], "no-use-before-define": "off", "@typescript-eslint/no-use-before-define": [ "error", { "functions": true, "classes": true, "variables": true, "typedefs": true } ], "no-useless-constructor": "off", "@typescript-eslint/no-useless-constructor": ["error"], "quotes": "off", "@typescript-eslint/quotes": [ "error", "single", { "allowTemplateLiterals": true } ], "require-await": "off", "@typescript-eslint/require-await": "error", "no-return-await": "off", "@typescript-eslint/return-await": ["error", "in-try-catch"], "semi": "off", "@typescript-eslint/semi": ["error", "always"], "space-before-function-paren": "off", "@typescript-eslint/space-before-function-paren": ["error", "never"], "@typescript-eslint/explicit-module-boundary-types": "off", "import/default": "error", "import/named": "error", "import/namespace": "error", "import/no-absolute-path": "error", "import/no-cycle": "error", "import/no-internal-modules": "off", "import/no-self-import": "error", "import/no-unresolved": "error", "import/no-useless-path-segments": [ "error", { "noUselessIndex": true } ], "import/export": "error", "import/no-deprecated": "warn", "import/no-mutable-exports": "warn", "import/no-named-as-default": "warn", "import/no-named-as-default-member": "warn", "import/no-unused-modules": [ "warn", { "missingExports": false, "unusedExports": true } ], "import/unambiguous": "warn", "import/no-amd": "warn", "import/extensions": [ "error", "ignorePackages", { "js": "never", "mjs": "never", "jsx": "never", "ts": "never", "tsx": "never" } ], "import/first": "error", "import/group-exports": "error", "import/newline-after-import": [ "error", { "count": 1 } ], "import/no-default-export": "error", "import/no-duplicates": "warn", "import/prefer-default-export": "off", "jsdoc/check-types": ["warn", { "unifyParentAndChildTypeChecks": true }], "jsdoc/require-jsdoc": [ "warn", { "checkConstructors": false, "checkGetters": true, "checkSetters": true, "contexts": ["ClassProperty"], "require": { "ArrowFunctionExpression": true, "ClassDeclaration": true, "ClassExpression": true, "FunctionDeclaration": true, "FunctionExpression": true, "MethodDefinition": true }, "enableFixer": true } ], "jsdoc/check-line-alignment": ["warn", "always"], "jsdoc/check-indentation": "warn", "jsdoc/check-param-names": [ "error", { "checkRestProperty": true, "enableFixer": true, "checkDestructured": true } ], "jsdoc/check-property-names": [ "error", { "enableFixer": true } ], "jsdoc/check-syntax": "warn", "jsdoc/empty-tags": "error", "jsdoc/require-hyphen-before-param-description": ["warn", "never"], "jsdoc/require-description": [ "warn", { "contexts": [ "ClassDeclaration" ], "descriptionStyle": "any", "checkGetters": false, "checkSetters": false } ], "jsdoc/require-param": [ "error", { "enableFixer": true, "enableRootFixer": true, "enableRestElementFixer": true, "checkRestProperty": true, "autoIncrementBase": 0, "checkConstructors": true, "checkGetters": true, "checkSetters": true, "checkDestructured": true } ], "jsdoc/require-param-type": "warn", "jsdoc/require-param-description": "off", "jsdoc/require-returns": [ "warn", { "checkConstructors": false, "checkGetters": true, "forceRequireReturn": false, "forceReturnsWithAsync": false } ], "jsdoc/require-returns-check": "warn", "jsdoc/require-returns-type": "error", "jsdoc/require-returns-description": "off" }, "settings": { "import/cache": { "lifetime": 5 }, "import/extensions": [".js", ".mjs", ".ts", ".d.ts", ".json"], "import/external-module-folders": ["node_modules", "node_modules/@types"], "import/parsers": { "@typescript-eslint/parser": [".ts", ".d.ts"] }, "import/resolver": { "node": { "extensions": [".js", ".mjs", ".ts", ".d.ts",".json"] } }, "jsdoc": { "mode": "typescript", "ignorePrivate": true, "tagNamePreference": { "inheritDoc": { "message": "Lowercase is prefered", "replacement": "inheritdoc" } } } } } ```
Configuration `tsconfig.eslint.json` ```json { "extends": "./tsconfig.base.json", "include": [ "js/**/*", ".eslintrc.json", "tsconfig.json", "tsconfig.base.json", "tsconfig.eslint.json", "gulpfile.js", "jsdoc.json" ], "exclude": ["node_modules"] } ```
Configuration `tsconfig.base.json` ```json { "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "target": "ESNext", // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. "module": "ESNext", // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. "lib": [ // Specify library files to be included in the compilation. "ES2020", "DOM", "WebWorker" ], "allowJs": true, // Allow javascript files to be compiled. "checkJs": true, // Report errors in .js files. //"outDir": "build", // Redirect output structure to the directory. //"rootDir": ".", // Specify the root directory of input files. Use to control the output directory structure with --outDir. // Strict Checks "alwaysStrict": true, // Parse in strict mode and emit "use strict" for each source file "strict": true, // Enable all strict type-checking options. "noImplicitAny": true, // Raise error on expressions and declarations with an implied 'any' type. "strictPropertyInitialization": true, // Module Resolution Options "esModuleInterop": false, // Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. // Advanced Options "resolveJsonModule": true // Include modules imported with '.json' extension //"skipLibCheck": true //"baseUrl": "." }, "include": ["./js/**/*"] } ```
package.json ```json { "name": "pathfinder-eve", "version": "2.0.0", "engines": { "node": "12.x" }, "description": "Pathfinder is a system mapping tool for EVE ONLINE", "root": true, "main": "index.php", "type": "module", "dependencies": { "easytimer.js": "^4.3.0", "jquery": "^3.5.1", "localforage": "^1.9.0", "mustache": "^4.0.1", "pnotify": "^5.1.2", "velocity-animate": "^2.0.6" }, "devDependencies": { "@types/node": "^14.14.2", "@typescript-eslint/eslint-plugin": "^4.5.0", "@typescript-eslint/parser": "^4.5.0", "ansi-colors": "^4.1.1", "eslint": "^7.12.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsdoc": "^30.7.3", "eslint-plugin-json": "^2.x.x", "fancy-log": "^1.3.3", "file-extension": "^4.0.5", "flat": "^5.0.2", "gulp": "^4.0.2", "gulp-autoprefixer": "^7.0.1", "gulp-brotli": "^3.0.0", "gulp-bytediff": "1.0.x", "gulp-clean-css": "^4.3.0", "gulp-debug": "^4.0.0", "gulp-filter": "^6.0.0", "gulp-gzip": "1.x.x", "gulp-if": "^3.0.0", "gulp-image-resize": "^0.13.1", "gulp-imagemin": "^7.1.0", "gulp-jshint": "2.1.x", "gulp-rename": "^2.0.0", "gulp-requirejs-optimize": "1.3.x", "gulp-sass": "^4.1.0", "gulp-sourcemaps": "^2.6.5", "gulp-uglify": "^3.0.2", "imagemin-webp": "^6.0.0", "jshint": "^2.12.0", "jshint-stylish": "^2.x.x", "lodash.padend": "4.6.x", "module-lookup-amd": "^6.2.0", "node-notifier": "^8.0.0", "node-sass": "^4.14.1", "pretty-bytes": "^5.4.1", "promised-del": "1.0.x", "rollup": "^2.32.1", "rollup-plugin-amd": "^4.0.0", "slash": "^3.0.0", "terminal-table": "0.0.x", "typescript": "^4.0.3", "uglify-es": "^3.0.x" }, "scripts": { "gulp": "gulp", "eslint": "eslint", "eslint-find-option-rules": "eslint-find-rules" }, "repository": { "type": "git", "url": "git+https://github.com/exodus4d/pathfinder.git" }, "browserslist": [ "last 2 versions", "> 2%", "not dead", "not IE 11" ], "keywords": [ "pathfinder", "exodus 4d", "eve online", "wormhole", "mapping" ], "author": "Exodus 4D (https://github.com/exodus4d)", "license": "MIT", "bugs": { "url": "https://github.com/exodus4d/pathfinder/issues", "email": "pathfinder@exodus4d.de" }, "homepage": "https://github.com/exodus4d/pathfinder#readme", "private": true } ```

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

G:\webpages\pathfinder>npm run eslint -c ".eslintrc.json" ".\js\app\conf\appConfig.mjs"

> pathfinder-eve@2.0.0 eslint
> eslint ".\\js\\app\\conf\\appConfig.mjs"

Oops! Something went wrong! :(

ESLint: 7.12.0

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:258:15)
    at validateString (node:internal/validators:123:11)
    at Object.extname (node:path:752:5)
    at loadConfigFile (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:305:18)
    at ConfigArrayFactory._loadConfigData (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:608:42)
    at ConfigArrayFactory._loadExtendedBuiltInConfig (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:801:25)
    at ConfigArrayFactory._loadExtends (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:777:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:721:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (G:\webpages\pathfinder\node_modules\@eslint\eslintrc\lib\config-array-factory.js:666:20)
npm ERR! code 2
npm ERR! path G:\webpages\pathfinder
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "eslint ".\\js\\app\\conf\\appConfig.mjs""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Exodus~1\AppData\Roaming\npm-cache\_logs\2020-10-24T18_00_36_266Z-debug.log

What did you expect to happen? The issue happened just after the update from ESLint v7.11.0 to v7.12.0

What else might be "special" on my setup?


Maybe this help to find the issue. I added some output in the stacktrace, right before the Error:

  1. https://github.com/eslint/eslintrc/blob/04f3cae17fe07b2fd0b74fd3e88482b3094e75e3/lib/config-array-factory.js#L607-L609

    _loadConfigData(ctx) {
        console.dir(ctx)
        return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx);
    }

    shows filePath: undefined:

    {
    filePath: undefined,
    matchBasePath: 'G:\\webpages\\pathfinder',
    name: '.eslintrc.json » eslint:recommended',
    pluginBasePath: 'G:\\webpages\\pathfinder',
    type: 'config'
    }
  2. One step back in trace: https://github.com/eslint/eslintrc/blob/04f3cae17fe07b2fd0b74fd3e88482b3094e75e3/lib/config-array-factory.js#L794-L803

    _loadExtendedBuiltInConfig(extendName, ctx) {
        const { eslintAllPath, eslintRecommendedPath } = internalSlotsMap.get(this);
        if (extendName === "eslint:recommended") {
            console.dir(internalSlotsMap.get(this));
            return this._loadConfigData({
                ...ctx,
                filePath: eslintRecommendedPath,
                name: `${ctx.name} » ${extendName}`
            });
        }

    shows eslintRecommendedPath: undefined

    {
    additionalPluginPool: Map(0) {},
    cwd: 'G:\\webpages\\pathfinder',
    resolvePluginsRelativeTo: undefined,
    builtInRules: Map(0) {},
    resolver: { resolve: [Function: resolve] },
    eslintAllPath: undefined,
    eslintRecommendedPath: undefined
    }
ljharb commented 3 years ago

cc @bradzacher

mdjermanovic commented 3 years ago

Thanks for so many details!

Can you please check the version in G:\webpages\pathfinder\node_modules\@eslint\eslintrc\package.json ?

exodus4d commented 3 years ago

Here it is:

  "name": "@eslint/eslintrc",
  "version": "0.1.3"

When I switch back to 7.11.0 the issue is gone.

mdjermanovic commented 3 years ago

This looks like a problem with the package manager, ESLint v7.12.0 has dependency "@eslint/eslintrc": "^0.2.0", but is getting 0.1.3.

exodus4d commented 3 years ago

YeahI can confirm this. I even get the information that @eslint/eslintrc 0.2.0 is installed:

G:\webpages\pathfinder>npm list @eslint/eslintrc --depth=2
pathfinder-eve@2.0.0 G:\webpages\pathfinder
`-- eslint@7.12.0
  `-- @eslint/eslintrc@0.2.0
...same output with: `npm list --depth=1` (expand me) ```cmd G:\webpages\pathfinder>npm list --depth=1 pathfinder-eve@2.0.0 G:\webpages\pathfinder +-- @types/node@14.14.2 +-- @typescript-eslint/eslint-plugin@4.5.0 | +-- @typescript-eslint/experimental-utils@4.5.0 | +-- @typescript-eslint/parser@4.5.0 deduped | +-- @typescript-eslint/scope-manager@4.5.0 | +-- debug@4.2.0 | +-- eslint@7.12.0 deduped | +-- functional-red-black-tree@1.0.1 | +-- regexpp@3.1.0 | +-- semver@7.3.2 | `-- tsutils@3.17.1 +-- @typescript-eslint/parser@4.5.0 | +-- @typescript-eslint/scope-manager@4.5.0 deduped | +-- @typescript-eslint/types@4.5.0 | +-- @typescript-eslint/typescript-estree@4.5.0 | +-- debug@4.2.0 deduped | `-- eslint@7.12.0 deduped +-- ansi-colors@4.1.1 +-- easytimer.js@4.3.0 +-- eslint-plugin-import@2.22.1 | +-- array-includes@3.1.1 | +-- array.prototype.flat@1.2.3 | +-- contains-path@0.1.0 | +-- debug@2.6.9 | +-- doctrine@1.5.0 | +-- eslint-import-resolver-node@0.3.4 | +-- eslint-module-utils@2.6.0 | +-- eslint@7.12.0 deduped | +-- has@1.0.3 | +-- minimatch@3.0.4 | +-- object.values@1.1.1 | +-- read-pkg-up@2.0.0 | +-- resolve@1.18.1 | `-- tsconfig-paths@3.9.0 +-- eslint-plugin-jsdoc@30.7.3 | +-- comment-parser@0.7.6 | +-- debug@4.2.0 deduped | +-- eslint@7.12.0 deduped | +-- jsdoctypeparser@9.0.0 | +-- lodash@4.17.20 | +-- regextras@0.7.1 | +-- semver@7.3.2 deduped | `-- spdx-expression-parse@3.0.1 +-- eslint-plugin-json@2.1.2 | +-- lodash@4.17.20 deduped | `-- vscode-json-languageservice@3.9.1 +-- eslint@7.12.0 <=== | +-- @babel/code-frame@7.10.4 | +-- @eslint/eslintrc@0.2.0 <=== | +-- ajv@6.12.6 | +-- chalk@4.1.0 | +-- cross-spawn@7.0.3 | +-- debug@4.2.0 deduped | +-- doctrine@3.0.0 | +-- enquirer@2.3.6 | +-- eslint-scope@5.1.1 | +-- eslint-utils@2.1.0 | +-- eslint-visitor-keys@2.0.0 | +-- espree@7.3.0 | +-- esquery@1.3.1 | +-- esutils@2.0.3 | +-- file-entry-cache@5.0.1 | +-- functional-red-black-tree@1.0.1 deduped | +-- glob-parent@5.1.1 | +-- globals@12.4.0 | +-- ignore@4.0.6 | +-- import-fresh@3.2.1 | +-- imurmurhash@0.1.4 | +-- is-glob@4.0.1 | +-- js-yaml@3.14.0 | +-- json-stable-stringify-without-jsonify@1.0.1 | +-- levn@0.4.1 | +-- lodash@4.17.20 deduped | +-- minimatch@3.0.4 deduped | +-- natural-compare@1.4.0 | +-- optionator@0.9.1 | +-- progress@2.0.3 | +-- regexpp@3.1.0 deduped | +-- semver@7.3.2 deduped | +-- strip-ansi@6.0.0 | +-- strip-json-comments@3.1.1 | +-- table@5.4.6 | +-- text-table@0.2.0 | `-- v8-compile-cache@2.1.1 ```

G:\webpages\pathfinder\node_modules\@eslint\eslintrc\package.json does not reflect that and shows version 0.1.3 :)

G:\webpages\pathfinder\node_modules\@eslint\eslintrc\package.json (expand me) ```json { "name": "@eslint/eslintrc", "version": "0.1.3", "description": "The legacy ESLintRC config file format for ESLint", "main": "lib/index.js", "files": [ "lib", "conf", "LICENSE" ], "publishConfig": { "access": "public" }, "scripts": { "lint": "eslint .", "test": "mocha tests/lib/shared", "generate-release": "eslint-generate-release", "generate-alpharelease": "eslint-generate-prerelease alpha", "generate-betarelease": "eslint-generate-prerelease beta", "generate-rcrelease": "eslint-generate-prerelease rc", "publish-release": "eslint-publish-release" }, "repository": "eslint/eslintrc", "keywords": [ "ESLint", "ESLintRC", "Configuration" ], "author": "Nicholas C. Zakas", "license": "MIT", "bugs": { "url": "https://github.com/eslint/eslintrc/issues" }, "homepage": "https://github.com/eslint/eslintrc#readme", "devDependencies": { "chai": "^4.2.0", "eslint": "^7.7.0", "eslint-config-eslint": "^6.0.0", "eslint-plugin-jsdoc": "^22.1.0", "eslint-plugin-node": "^11.1.0", "eslint-release": "^3.1.2", "mocha": "^8.1.1" }, "dependencies": { "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", "globals": "^12.1.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", "lodash": "^4.17.19", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, "engines": { "node": "^10.12.0 || >=12.0.0" } } ```

I get the same result after a reinstall:

Could this be a caching issue? - Ill do some more tests, maybe I figure out something. I can also try an manually install @eslint/eslintrc@0.2.0

exodus4d commented 3 years ago

I made some more investigations:

NPM packeges eslint+ eslintrc do have the correct version after npm i in my project root. (My previous comment can be ignored).:

npm list --depth=1 ``` +-- eslint@7.12.0 | +-- @babel/code-frame@7.10.4 | +-- @eslint/eslintrc@0.2.0 | +-- ajv@6.12.6 | +-- chalk@4.1.0 | +-- cross-spawn@7.0.3 | +-- debug@4.2.0 deduped | +-- doctrine@3.0.0 | +-- enquirer@2.3.6 | +-- eslint-scope@5.1.1 | +-- eslint-utils@2.1.0 | +-- eslint-visitor-keys@2.0.0 | +-- espree@7.3.0 | +-- esquery@1.3.1 | +-- esutils@2.0.3 | +-- file-entry-cache@5.0.1 | +-- functional-red-black-tree@1.0.1 deduped | +-- glob-parent@5.1.1 | +-- globals@12.4.0 | +-- ignore@4.0.6 | +-- import-fresh@3.2.1 | +-- imurmurhash@0.1.4 | +-- is-glob@4.0.1 | +-- js-yaml@3.14.0 | +-- json-stable-stringify-without-jsonify@1.0.1 | +-- levn@0.4.1 | +-- lodash@4.17.20 | +-- minimatch@3.0.4 | +-- natural-compare@1.4.0 | +-- optionator@0.9.1 | +-- progress@2.0.3 | +-- regexpp@3.1.0 deduped | +-- semver@7.3.2 deduped | +-- strip-ansi@6.0.0 | +-- strip-json-comments@3.1.1 | +-- table@5.4.6 | +-- text-table@0.2.0 | `-- v8-compile-cache@2.1.1 ```

But this does not solve my initial error. I was able to further reduce the origin of the error:

mdjermanovic commented 3 years ago

@exodus4d would everything else work well if you turn off just import/no-unused-modules rule?

mdjermanovic commented 3 years ago

The problem with no-unused-modules is that it requires ESLint's internal module FileEnumerator, but now configArrayFactory argument basically must be passed to the FileEnumerator constructor.

https://github.com/benmosher/eslint-plugin-import/blob/13aa29c4d7a4c0fc86a1739d31c576c43150d4ce/src/rules/no-unused-modules.js#L19-L30

exodus4d commented 3 years ago

Yes everything seems to work if "import/no-unused-modules": "off .

Here is a short record:

eslint

ljharb commented 3 years ago

@mdjermanovic that seems like a breaking change in publicly accessible API, in a minor version :-/

mdjermanovic commented 3 years ago

Thanks for the thorough investigation!

If I understand correctly, there was a problem with npm upgrading the dependencies, but that happens sometimes and deleting node_modules + npm i helps as always. There's nothing to fix in ESLint about that.

The other problem is with import/no-unused-modules using an internal API that has changed now.

mdjermanovic commented 3 years ago

@mdjermanovic that seems like a breaking change in publicly accessible API, in a minor version :-/

I'll leave this issue open for discussion, but we have public API documented here:

https://eslint.org/docs/developer-guide/nodejs-api

https://github.com/eslint/eslint/issues/13654 will really help to avoid these problems