Skip to content

Commit 07f63fd

Browse files
authored
feat!: ESLint 9 and Flat Config (#33)
* docs: outline some intended breaking changes in the next major release * feat!: initial implementation without much test * chore: remove vue cli examples * chore: set up new examples * chore: detail the reason for the implicit dependency on pluginVue.configs['flat/base'] * chore: complete the js example * feat: initial implementation of -with-typescript config * chore: update deps * feat!: refactored the -with-typescript config with dependency on @vue/eslint-config-typescript 14.3 * chore: update ts examples * fix: @vue/eslint-config-standard is a dep, not a dev dep * fix: missing dev dep * chore: technically @vue/eslint-config-typescript can be optional * style: don't break lines for consistency with example packages
1 parent 2d65f05 commit 07f63fd

File tree

425 files changed

+8861
-12479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

425 files changed

+8861
-12479
lines changed

.changeset/dry-points-agree.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@vue/eslint-config-standard": major
3+
---
4+
5+
* Supports ESLint ^9.10, Node.js ^18.18.0 || ^20.9.0 || >=21.1.0, drops support for older versions.
6+
* Supports ESLint Flat Config, drops support for legacy `.eslintrc*` configuration format.
7+
* Removed `createAliasSetting` helper function, as we now automatically detects path aliases in `jsconfig.json` and `tsconfig.json` files.
8+
* Removed examples of Vue CLI project setups.
9+
* Stylistic rules also apply to expressions in `<template>` blocks.
10+
11+
Internal Changes:
12+
13+
* Drops `eslint-config-standard` as a dependency as it never released the latest code that would support Flat Config; we have to maintain the rules ourselves.
14+
* Moved from `eslint-plugin-import` to `eslint-plugin-import-x`.
15+
* Use stylistic rules from `@stylistic/eslint-plugin` instead of the ESLint built-in ones.
16+
* Other dependency updates.

.changeset/mean-owls-invent.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@vue/eslint-config-standard-with-typescript": major
3+
---
4+
5+
* Updated `@vue/eslint-config-standard` to v9.*, see its changelog for breaking changes.
6+
* It's now only a thin wrapper around `@vue/eslint-config-standard`. Please use this package in combination with `@vue/eslint-config-typescript`.
7+
* Most of the [`typescript-eslint`-specific rules in the previous version](https://unpkg.com/browse/[email protected]/lib/index.js#L65) are now removed. Please refer to [`typescript-eslint` shared configs](https://typescript-eslint.io/users/configs/#recommended-configurations) for more strict rulesets.
8+
* Removes `createAliasSetting` helper for unconventional TSConfig locations support.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ESLint [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for [JavaScript Standard Style](http://standardjs.com) in [Vue.js](https://vuejs.org/) Projects
1+
# ESLint [Shareable Configs](https://eslint.org/docs/latest/extend/shareable-configs) for [JavaScript Standard Style](http://standardjs.com) in [Vue.js](https://vuejs.org/) Projects
22

33
[![JavaScript Style Guide - Standard Style](https://raw.githubusercontent.com/standard/standard/master/badge.svg)](http://standardjs.com)
44

@@ -9,4 +9,4 @@ This repo contains 2 packages:
99
- If you are using ESLint in a JavaScript-only project, check the documentation of [`@vue/eslint-config-standard`](./packages/eslint-config-standard#readme)
1010
- If you are using ESLint in a TypeScript project, check the documentation of [`@vue/eslint-config-standard-with-typescript`](./packages/eslint-config-standard-with-typescript#readme)
1111

12-
The [`examples` folder](./examples/) contains example ESLint configurations in projects created by `create-vue` or `@vue/cli`.
12+
The [`examples` folder](./examples/) contains example ESLint configurations in projects created by `create-vue`.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
[*.{js,jsx,ts,tsx,vue}]
2-
indent_style = space
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
2+
charset = utf-8
33
indent_size = 2
4-
trim_trailing_whitespace = true
4+
indent_style = space
55
insert_final_newline = true
6+
trim_trailing_whitespace = true

examples/create-vue-ts-allow-js-in-vue/.gitignore renamed to examples/allow-js/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ coverage
2626
*.njsproj
2727
*.sln
2828
*.sw?
29+
30+
*.tsbuildinfo
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"vitest.explorer",
5+
"dbaeumer.vscode-eslint",
6+
"EditorConfig.EditorConfig"
7+
]
8+
}

examples/allow-js/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# allow-js
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Type Support for `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12+
13+
## Customize configuration
14+
15+
See [Vite Configuration Reference](https://vite.dev/config/).
16+
17+
## Project Setup
18+
19+
```sh
20+
pnpm install
21+
```
22+
23+
### Compile and Hot-Reload for Development
24+
25+
```sh
26+
pnpm dev
27+
```
28+
29+
### Type-Check, Compile and Minify for Production
30+
31+
```sh
32+
pnpm build
33+
```
34+
35+
### Run Unit Tests with [Vitest](https://vitest.dev/)
36+
37+
```sh
38+
pnpm test:unit
39+
```
40+
41+
### Lint with [ESLint](https://eslint.org/)
42+
43+
```sh
44+
pnpm lint
45+
```

examples/allow-js/eslint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import vueTsEslintConfig from '@vue/eslint-config-typescript'
3+
import pluginVitest from '@vitest/eslint-plugin'
4+
5+
export default [
6+
{
7+
name: 'app/files-to-lint',
8+
files: ['**/*.{ts,mts,tsx,vue}'],
9+
},
10+
11+
{
12+
name: 'app/files-to-ignore',
13+
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
14+
},
15+
16+
...pluginVue.configs['flat/essential'],
17+
...vueTsEslintConfig(),
18+
19+
{
20+
...pluginVitest.configs.recommended,
21+
files: ['src/**/__tests__/*'],
22+
},
23+
]

examples/create-vue-ts-allow-tsx-in-vue/index.html renamed to examples/allow-js/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="">
33
<head>
4-
<meta charset="UTF-8" />
5-
<link rel="icon" href="/favicon.ico" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<title>Vite App</title>
88
</head>
99
<body>

0 commit comments

Comments
 (0)