Closed
Description
Version
3.0.0-rc.3
Reproduction link
https://github.com/marcus-blaettermann-ventoro/vue-cli-bug/tree/master
Steps to reproduce
Clone the given repo, npm install
and then npm run lint
Alternative: Run vue create
with those settings:
Vue CLI v3.0.0-rc.3
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, TS, Linter
? Use class-style component syntax? No
? Use Babel alongside TypeScript for auto-detected polyfills? No
? Pick a linter / formatter config: Airbnb
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? (y/N)
Then add this to the src/components/Hello-World.vue:
enum Direction {
Up,
Down,
}
const foo: Direction = Direction.Up;
What is expected?
The linter should not find any errors, or at least should fix the errors it finds.
What is actually happening?
The linter adds a space before one of the commas in the enum Direction
and then complains about it. Removing the space has no effect because the linter adds it the next time again. When using lint on save in an editor, the comma jumps between the first and second line.
- This has been reproduced on both Mac and Windows.
- The problem doesn`t occure with the same code in a regular .ts file
- The problem only occurs, when an enum (something regular JavaScript doesn`t have) followed by something with a type declaration.
- The problem also occurs, when the enum is in a single line.
enum Direction { Up, Down }
- If the
const foo : Direction = Direction.Up;
is removed the linter doesn`t mind the enum anymore. - I think the linter somehow chokes on the type declaration colon.