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

Move to Eslint 5 #2322

Closed
pksunkara opened this issue Aug 22, 2018 · 9 comments
Closed

Move to Eslint 5 #2322

pksunkara opened this issue Aug 22, 2018 · 9 comments

Comments

@pksunkara
Copy link
Contributor

What problem does this feature solve?

We are currently using eslint 4 and lot of people have moved to eslint 5. So, we should do that too.

What does the proposed API look like?

Update the cli-plugin-eslint package

@bviala
Copy link

bviala commented Aug 25, 2018

Also @vue/cli-plugin-eslint needs eslint@^4.19.1, and @vue/eslint-config-standard needs eslint@^5.0.0-alpha.2

Which means you get a peer dependency incompatibility if you generate a project chosing standard config for eslint.

@pksunkara
Copy link
Contributor Author

Well, this issue is about fixing that.

@silentHoo
Copy link

silentHoo commented Sep 6, 2018

As this is related to my problem I'll append the log I get when I run vue create example:

This is my config I chose:

vue create example

Vue CLI v3.0.1
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, TS, Router, CSS Pre-processors, Linter, Unit, E2E
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript for auto-detected polyfills? Yes
? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): SCSS/SASS
? Pick a linter / formatter config: Standard
? Pick additional lint features: Lint on save
? Pick a unit testing solution: Jest
? Pick a E2E testing solution: Nightwatch
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? Yes

The setup works surpesses all the peer dependency warnings, but when I remove all the modules (rm -rf ./node_modules) and re-install again, I get this issues:

yarn install
yarn install v1.5.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@vue/cli-plugin-babel > babel-loader@8.0.2" has incorrect peer dependency "@babel/core@^7.0.0".
warning "@vue/cli-plugin-babel > babel-loader@8.0.2" has unmet peer dependency "webpack@>=2".
warning "@vue/cli-plugin-eslint > eslint-loader@2.1.0" has unmet peer dependency "webpack@>=2.0.0 <5.0.0".
warning "@vue/cli-plugin-typescript > fork-ts-checker-webpack-plugin@0.4.9" has unmet peer dependency "webpack@^2.3.0 || ^3.0.0 || ^4.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has unmet peer dependency "eslint@>=5.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-node@>=7.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-promise@>=4.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-standard@>=4.0.0".
warning "@vue/eslint-config-standard > eslint-plugin-import@2.14.0" has unmet peer dependency "eslint@2.x - 5.x".
warning "@vue/eslint-config-standard > eslint-plugin-node@6.0.1" has unmet peer dependency "eslint@>=3.1.0".
warning "@vue/eslint-config-standard > eslint-plugin-standard@3.1.0" has unmet peer dependency "eslint@>=3.19.0".
warning " > babel-core@7.0.0-bridge.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
warning " > ts-jest@23.1.4" has unmet peer dependency "babel-jest@^23.0.0 || ^24.0.0".
warning " > ts-jest@23.1.4" has unmet peer dependency "jest@^23.0.0 || ^24.0.0".
[4/4] 📃  Building fresh packages...
✨  Done in 30.26s.

I can fix this by adding the missing devDeps, but that's not the proper way. A quickfix for me is to add these deps (for my config):

"devDependencies": {
    "@babel/core": "^7.0.0",
    // ...
    "babel-jest": "^23.4.2",
    "babel-loader": "^8.0.2",
    "eslint": "^5.5.0",
    "eslint-loader": "^2.1.0",
    "eslint-plugin-node": "^7.0.1",
    "eslint-plugin-promise": "^4.0.0",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^4.7.1",
    "jest": "^23.5.0",
    // ...
    "webpack": "^4.17.2"
  }

@unikitty37
Copy link

Is there any news on this? I'm trying to have vue-cli-service lint run as a pre-commit hook, but it's failing on the following line in my .eslintrc:

'array-element-newline': ['warn', 'consistent'],

with the following error:

Configuration for rule "array-element-newline" is invalid:
Value "consistent" should be equal to one of the allowed values.
Value "consistent" should be object.
Value "consistent" should match exactly one schema in oneOf.

It's really frustrating to have stuff that's valid according to the eslint documentation be rejected because of a hard dependency on an old version of eslint…

@haoqunjiang
Copy link
Member

@unikitty37 See #2560
We'd also like to bump ESLint version in the next minor release.

@gassius
Copy link

gassius commented Apr 18, 2019

I am missing something regarding this issue?
Because in these lines from 3.6.0 still appears a dependency for eslint 4

This still causes a warning with yarn install

warning @vue/cli-plugin-eslint > eslint > file-entry-cache > flat-cache > circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.

eslint 5 resolves that bring from upstream a flat-cache package that does not require CircularJSON and use flatted.

Please advice

@haoqunjiang
Copy link
Member

@gassius In more recent scaffolded projects we've added eslint v5 to the projects' root devDependencies and use that by default. But we have to keep the v4 in the dependency chain as a fallback for compatibility reasons.

@gassius
Copy link

gassius commented Apr 18, 2019

Thanks @sodatea
In the package.json for my project, which was scaffolded before 3.6.0 release, I am explicitly defining "eslint": "^5.16.0", in devDependencies, but still got the aforementioned warning.

Any idea or workaround I could apply? tried with resolutions with no success

@haoqunjiang
Copy link
Member

Considering it's a warning rather than an error, I think you can safely ignore it.

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

No branches or pull requests

6 participants