ijsto / eslint-config Goto Github PK
View Code? Open in Web Editor NEWESLint + Prettier setup for VS Code by iJS
ESLint + Prettier setup for VS Code by iJS
prettier
dependency is a peerDependencies of eslint-plugin-prettier
.
eslint-plugin-prettier
plugin can be disabled changing .eslintrc.yml file as follow:
rules:
prettier/prettier: 0
So prettier
dependency is useless in dependencies of package.json file and, to prevent its install, it should be removed from dependencies and become optional.
Changes in package.json file:
prettier
dependency from dependencies (run yarn remove prettier
) "peerDependencies": {
...
"prettier": ">= 2.x.x" // OR exact version; it should be equal/compatible/maintained with peerDependency.prettier version value of eslint-plugin-prettier
},
"peerDependenciesMeta": {
"prettier": {
"optional": true
}
}
PS: these changes must be tested
eslint
version 8 was released and I got warning on install step.
yarn init -y
yarn set version berry
yarn add eslint @ijsto/eslint-config
...
➤ YN0060: │ test-eslint@workspace:. provides eslint (p05a5b) with version 8.0.0, which doesn't satisfy what @ijsto/eslint-config and some of its descendants request
...
No warning in log
eslint
: 8.0.0@ijsto/eslint-config
: 4.1.6This issue is confirmed and is a composite issue which requires for a wider ecosystem support for ESLint v8.
We are aware of this, we will monitor and update the codebase to provide support to ESLint v8 as soon as it's possible.
This issue, using yarn version >= 3.2.0-rc.7, is related to a conflict with 2 different ESLint config of eslint-plugin-import
:
yarn init -y
yarn set version canary
(currently install yarn v3.2.0-rc.9)yarn add @ijsto/eslint-config eslint eslint-config-next next react react-dom
.eslintrc.yml
file :extends:
- '@ijsto'
- next
index.js
fileyarn eslint index.js
--> output:Oops! Something went wrong! :(
ESLint: 8.4.1
ESLint couldn't determine the plugin "import" uniquely.
- C:\test-eslint\.yarn\__virtual__\eslint-plugin-import-virtual-2a929f9851\0\cache\eslint-plugin-import-npm-2.25.3-f5faefaae3-8bdf4b1faf.zip\node_modules\eslint-plugin-import\lib\index.js (loaded in ".eslintrc.yml » eslint-config-next")
- C:\test-eslint\.yarn\__virtual__\eslint-plugin-import-virtual-c11863593e\0\cache\eslint-plugin-import-npm-2.25.3-f5faefaae3-8bdf4b1faf.zip\node_modules\eslint-plugin-import\lib\index.js (loaded in ".eslintrc.yml » @ijsto/eslint-config » eslint-config-airbnb » C:\test-eslint\.yarn\__virtual__\eslint-config-airbnb-base-virtual-daa201a79f\0\cache\eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip\node_modules\eslint-config-airbnb-base\index.js » C:\test-eslint\.yarn\__virtual__\eslint-config-airbnb-base-virtual-daa201a79f\0\cache\eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip\node_modules\eslint-config-airbnb-base\rules\imports.js")
Please remove the "plugins" setting from either config or remove either plugin installation.
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team
yarn next lint index.js
--> output:Error: Plugin "import" was conflicted between ".eslintrc.yml » eslint-config-next" and ".eslintrc.yml » @ijsto/eslint-config » eslint-config-airbnb » C:\test-eslint\.yarn\__virtual__\eslint-config-airbnb-base-virtual-daa201a79f\0\cache\eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip\node_modules\eslint-config-airbnb-base\index.js » C:\test-eslint\.yarn\__virtual__\eslint-config-airbnb-base-virtual-daa201a79f\0\cache\eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip\node_modules\eslint-config-airbnb-base\rules\imports.js"
I know it seems silly, but you might want to add in the instructions that you need to have these extensions installed in VSCode:
ESLint (dbaeumer.vscode-eslint)
Prettier - Code formatter (esbenp.prettier-vscode)
Hi @ijsto, I see in my code some errors which might be related to typescript syntax:
I'm not quite certain because I read that the used babel parser should understand (or rather skip) typescript syntax.
So I'm also not quite sure if it is necessary to introduce the @typescript-eslint/parser
instead.
I would be willing to work on that but of course only if it is actually needed.
Do you know more about this topic?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.