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

migrate to eslint v7 #3

Closed
abhijithvijayan opened this issue May 10, 2020 · 7 comments
Closed

migrate to eslint v7 #3

abhijithvijayan opened this issue May 10, 2020 · 7 comments

Comments

@abhijithvijayan
Copy link
Owner

@abhijithvijayan abhijithvijayan commented May 10, 2020

migrate once CRA is released with eslint v7

See related issue

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 2, 2020

As it seems, airbnb and others have migrate to eslint v7, it is now safe to upgrade to v7.

Related issues

Possibly these errors can come up if you use v1.x.x of this package with eslint v7.x.x

Screenshot_20200702_195626

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 2, 2020

Node.js/Commonjs Rules have been deprecated(read more) in favour of eslint-plugin-node

This plugin will be used from v2.x.x of thi config package

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 2, 2020

Released in v2.2.3

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 2, 2020

For anyone who's migrating from v1.x.x to v2.x.x that uses Eslint v7 by default,

  1. Remove everything(it is better)
yarn remove @abhijithvijayan/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser babel-eslint eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks prettier
  1. Reinstall with new dependencies
# npm
npx install-peerdeps @abhijithvijayan/eslint-config --dev

# yarn
npx install-peerdeps @abhijithvijayan/eslint-config --dev --yarn
  1. Optional (if using TypeScript)

.eslintrc.json

{
	"extends": [
		...
		"@abhijithvijayan/eslint-config/typescript"
		...
	],
	// add this line
	"parserOptions": {
		"project": "./tsconfig.json",
		"sourceType": "module" // https://github.com/mysticatea/eslint-plugin-node#-configs
	},
	"rules": {
		// custom overrides
	}
}

@abhijithvijayan abhijithvijayan pinned this issue Jul 2, 2020
@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 2, 2020

As it seems like eslint-plugin-node throws a lot of errors even when it is not used for Node.js Apps.

Maybe it could be used as an option module to be used just like typescript or react

Update: config now exposes separate node module config as well

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 3, 2020

The node/file-extension-in-import rule in eslint-plugin-node adds the extension of file imported(as for --experimental-modules in Node.js 12) but TypeScript seems to cause issues when having "moduleResolution": "node" in tsconfig.json.

It might be set to explicit by the TypeScript team.

See related issues:

@abhijithvijayan
Copy link
Owner Author

@abhijithvijayan abhijithvijayan commented Jul 3, 2020

For now I can't seem to make both Eslint & TypeScript happy.

I am temporarily disabling the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant