Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Exception when upgrading to eslint 7.19.0 #2986

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

Closed
3 tasks done
doberkofler opened this issue Jan 31, 2021 · 1 comment · Fixed by #2993
Closed
3 tasks done

Exception when upgrading to eslint 7.19.0 #2986

doberkofler opened this issue Jan 31, 2021 · 1 comment · Fixed by #2993
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@doberkofler
Copy link
Contributor

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

After upgrading to eslint 7.19.0, I get the following error message:

TypeError: rules.ForInStatement, ForOfStatement is not a function
Occurred while linting /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend/jsonDataConvertPara.ts:44
    at ForInStatement, ForOfStatement (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js:119:63)
    at /Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/eslint/lib/linter/linter.js:952:32
    at Array.forEach (<anonymous>)

jsonDataConvertPara.ts:44

...
	if (!isObject(para) || Array.isArray(para)) {
		throw new Error('The parameter "data" must be an object or null');
	}

	for (const prop in para) { // line 44
		if (para.hasOwnProperty(prop)) {
			const VALUE = para[prop];
			const TYPE = getType(VALUE);
...

Expected Result

Actual Result

Additional Info

...
  eslint:file-enumerator Yield: jsonDataConvertPara.ts +302ms
  eslintrc:cascading-config-array-factory Load config files for /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend. +302ms
  eslintrc:cascading-config-array-factory Cache hit: /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend. +0ms
  eslint:cli-engine Lint /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend/jsonDataConvertPara.ts +302ms
  eslint:linter Linting code for /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend/jsonDataConvertPara.ts (pass 1) +2ms
  eslint:linter Verify +0ms
  eslint:linter With ConfigArray: /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend/jsonDataConvertPara.ts +0ms
  eslint:linter An error occurred while traversing +23ms
  eslint:linter Filename: /Users/doberkofler/MyDev/ljs_app/trunk/periscope/src/framework/backend/jsonDataConvertPara.ts +0ms
  eslint:linter Line: 44 +1ms
  eslint:linter Parser Options: {
  ecmaVersion: 8,
  ecmaFeatures: { jsx: true, globalReturn: false },
  project: [ './tsconfig.json', './test/selenium/tsconfig.json' ],
  sourceType: 'module'
} +0ms
  eslint:linter Parser Path: /Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/@typescript-eslint/parser/dist/index.js +0ms
  eslint:linter Settings: {
  jsdoc: { mode: 'typescript' },
  react: { version: 'detect' },
  'import/resolver': {
    node: { extensions: [Array] },
    webpack: {
      config: '/Users/doberkofler/MyDev/ljs_app/trunk/periscope/scripts/webpack.config.resolve.js'
    }
  }
} +0ms

Versions

package version
@typescript-eslint/eslint-plugin 4.14.1
@typescript-eslint/parser 4.14.1
TypeScript 4.1.3
ESLint 7.19.0
node 14.15.3
@doberkofler doberkofler added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Jan 31, 2021
@waitingsong
Copy link

waitingsong commented Jan 31, 2021

I run into same error when upgrade to eslint 7.19.0 :

const config = {
  method: 'GET',
  cache: true,
}
for (const [key, value] of Object.entries(config)) {
  console.log({key, value})
}

got:

Oops! Something went wrong! :(

ESLint: 7.19.0

TypeError: rules.ForInStatement, ForOfStatement is not a function
Occurred while linting E:\project\my\eslint-config\test\foo.ts:16
    at ForInStatement, ForOfStatement (E:\project\my\eslint-config\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-extra-parens.js:119:63)
    at E:\project\my\eslint-config\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)

waitingsong added a commit to waitingsong/eslint-config that referenced this issue Jan 31, 2021
waitingsong added a commit to waitingsong/eslint-config that referenced this issue Jan 31, 2021
@bradzacher bradzacher added bug Something isn't working good first issue Good for newcomers and removed triage Waiting for team members to take a look labels Jan 31, 2021
@armano2 armano2 added has pr there is a PR raised to close this and removed good first issue Good for newcomers labels Feb 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants