Skip to content

Commit

Permalink
refactor!: use @vue/create-eslint-config for ESLint config generation
Browse files Browse the repository at this point in the history
Airbnb & Standard options are not added yet.

The difference with the previous implementation is that we now
use `@vue/eslint-config-typescript` instead of
`@vue/eslint-config-typescript/recommended`, because I'm not very
satisfied with the current implementation of the latter config.
There are some edge cases that may confuse users.

I need to find time to refactor that package in the coming months.
  • Loading branch information
haoqunjiang committed Sep 4, 2022
1 parent 2f2b040 commit f4ac339
Show file tree
Hide file tree
Showing 5 changed files with 2,181 additions and 80 deletions.
58 changes: 58 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,64 @@ MIT

## Bundled dependencies

## @vue/create-eslint-config

License: MIT
By: Haoqun Jiang
Repository: git+https://github.com/vuejs/create-eslint-config.git

> MIT License
>
> Copyright (c) 2022 vuejs
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>

## javascript-stringify

License: MIT
By: Blake Embrey
Repository: git+https://github.com/blakeembrey/javascript-stringify.git

> The MIT License (MIT)
>
> Copyright (c) 2013 Blake Embrey ([email protected])
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
>

## kleur

License: MIT
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"devDependencies": {
"@types/eslint": "^8.4.6",
"@types/prompts": "^2.0.14",
"@vue/create-eslint-config": "^0.1.2",
"@vue/tsconfig": "^0.1.3",
"esbuild": "^0.14.53",
"esbuild-plugin-license": "^1.2.2",
Expand Down
Loading

4 comments on commit f4ac339

@segevfiner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sodatea This really messed with us...

Apparently even with npm create vue@3 it doesn't seem to grab the latest version consistently which caused us to use the older template on one computer and the newer on the other, friggin npm... not sure how to solve that, perhaps we need to point to a dist-tag? In addition @vue/eslint-config-typescript seems a bit broken and leaves no-unused-vars enabled which starts shouting at random stuff e.g. At defineEmits<{(e: 'foo', value: string): void}>(), see vuejs/eslint-config-typescript#14. What's the problem with @vue/eslint-config-typescript/recommended?

@haoqunjiang
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how to solve that, perhaps we need to point to a dist-tag?

In my experience, npx seems to cache the version resolution result for hours, or up to 1 day. Dist-tags don't seem to fix that problem. The only reliable fix is to use a full version number, i.e. npm create [email protected]

What's the problem with @vue/eslint-config-typescript/recommended?

Similar edge cases, but more subtle. Some rules are silently disabled without the user noticing.

@segevfiner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to open an issue so that @vue/eslint-config-typescript/recommended can be improved so that it can become the default again? Well configured ESLint is a huge time saver after all, the more useful rules the better IMHO.

@haoqunjiang
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I plan to open an issue elaborating on the details as soon as I'm back from my parental leave…

Please sign in to comment.