Skip to content

Commit 3bb6d2c

Browse files
authored
chore: upgrade eslint (#407)
* chore: upgrade eslint * update * fix
1 parent 15eee8d commit 3bb6d2c

Some content is hidden

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

51 files changed

+8131
-2307
lines changed

.github/contributing.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Hi! We are really excited that you are interested in contributing to `@intlify/b
1212
- Submit a pull request to `main` branch of `@intlify/bundle-tools` repository !
1313

1414
## Development Setup
15+
1516
You will need [Node.js](http://nodejs.org) **version 12+**, and [Yarn v1](https://classic.yarnpkg.com/).
1617

1718
After cloning the repo, run:
@@ -20,7 +21,6 @@ After cloning the repo, run:
2021
$ yarn # install the dependencies of the project
2122
```
2223

23-
2424
A high level overview of tools used:
2525

2626
- [TypeScript](https://www.typescriptlang.org/) as the development language
@@ -32,7 +32,6 @@ A high level overview of tools used:
3232
- [ESLint](https://eslint.org/) for code linting
3333
- [Prettier](https://prettier.io/) for code formatting
3434

35-
3635
## Scripts
3736

3837
### `yarn build`

.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ packages/**/lib
22
coverage
33
tsconfig.json
44
dist
5+
pnpm-lock.yaml
56
packages/**/examples/dist
7+
packages/**/CHANGELOG.md
68
packages/rollup-plugin-vue-i18n/examples/composition/index.js
79
packages/rollup-plugin-vue-i18n/examples/global/index.js
8-
packages/rollup-plugin-vue-i18n/examples/legacy/index.js
10+
packages/rollup-plugin-vue-i18n/examples/legacy/index.js

.prettierrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
semi: false
22
singleQuote: true
33
printWidth: 80
4-
trailingComma: "none"
5-
endOfLine: "auto"
6-
arrowParens: "avoid"
4+
trailingComma: 'none'
5+
endOfLine: 'auto'
6+
arrowParens: 'avoid'

.yarnrc.yml

-7
This file was deleted.

README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ The bundle tools for Vue I18n
77

88
## 📦 Packages
99

10-
| Package | Bundler | Version (click for changelogs) | Status |
11-
| ------------------------------------------------------------------ | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----- |
12-
| [@intlify/unplugin-vue-i18n](packages/unplugin-vue-i18n) | vite / webpack | [![unplugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/unplugin-vue-i18n.svg?label=%20&&color=yellow)](packages/unplugin-vue-i18n/CHANGELOG.md)| Stable |
13-
| [@intlify/vite-plugin-vue-i18n](packages/vite-plugin-vue-i18n) | vite | [![vite-plugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/vite-plugin-vue-i18n.svg?label=%20&&color=blueviolet)](packages/vite-plugin-vue-i18n/CHANGELOG.md) (**until Vite 3**)| Hot fix maintenance only |
14-
| [@intlify/vue-i18n-loader](packages/vue-i18n-loader) | webpack | [![vue-i18n-loader version](https://img.shields.io/npm/v/@intlify/vue-i18n-loader.svg?label=%20&color=blue)](packages/vue-i18n-loader/CHANGELOG.md) (**for [email protected]**)| Hot fix maintenance only |
15-
| [@intlify/rollup-plugin-vue-i18n](packages/rollup-plugin-vue-i18n) | rollup | [![rollup-plugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/rollup-plugin-vue-i18n.svg?label=%20&color=red)](packages/rollup-plugin-vue-i18n/CHANGELOG.md)| Hot fix maintenance only |
16-
10+
| Package | Bundler | Version (click for changelogs) | Status |
11+
| ------------------------------------------------------------------ | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------- |
12+
| [@intlify/unplugin-vue-i18n](packages/unplugin-vue-i18n) | vite / webpack | [![unplugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/unplugin-vue-i18n.svg?label=%20&&color=yellow)](packages/unplugin-vue-i18n/CHANGELOG.md) | Stable |
13+
| [@intlify/vite-plugin-vue-i18n](packages/vite-plugin-vue-i18n) | vite | [![vite-plugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/vite-plugin-vue-i18n.svg?label=%20&&color=blueviolet)](packages/vite-plugin-vue-i18n/CHANGELOG.md) (**until Vite 3**) | Hot fix maintenance only |
14+
| [@intlify/vue-i18n-loader](packages/vue-i18n-loader) | webpack | [![vue-i18n-loader version](https://img.shields.io/npm/v/@intlify/vue-i18n-loader.svg?label=%20&color=blue)](packages/vue-i18n-loader/CHANGELOG.md) (**for [email protected]**) | Hot fix maintenance only |
15+
| [@intlify/rollup-plugin-vue-i18n](packages/rollup-plugin-vue-i18n) | rollup | [![rollup-plugin-vue-i18n version](https://img.shields.io/npm/v/@intlify/rollup-plugin-vue-i18n.svg?label=%20&color=red)](packages/rollup-plugin-vue-i18n/CHANGELOG.md) | Hot fix maintenance only |
1716

1817
## 💪 Contribution
1918

TODO.md

-4
This file was deleted.

eslint.config.ts

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import {
2+
defineConfig,
3+
javascript,
4+
prettier,
5+
typescript
6+
} from '@kazupon/eslint-config'
7+
import path from 'node:path'
8+
9+
const __dirname = path.dirname(new URL(import.meta.url).pathname)
10+
11+
export default defineConfig(
12+
javascript(),
13+
typescript({
14+
parserOptions: {
15+
project: [
16+
path.join(__dirname, './tsconfig.json'),
17+
path.join(__dirname, './packages/unplugin-vue-i18n/tsconfig.json')
18+
]
19+
}
20+
}),
21+
prettier(),
22+
{
23+
name: 'ignores',
24+
ignores: [
25+
'packages/rollup-plugin-vue-i18n/*',
26+
'packages/vite-plugin-vue-i18n/*',
27+
'packages/vue-i18n-loader/*',
28+
'packages/unplugin-vue-i18n/lib/*',
29+
'packages/bundle-utils/lib/*',
30+
'examples/*',
31+
'**/test/fixtures/**',
32+
'**/*.config.ts',
33+
'**/dist/**',
34+
'**/.eslint-config-inspector/**',
35+
'**/tsconfig.json',
36+
'**/*.yml',
37+
'**/*.yaml',
38+
'**/*.json',
39+
'**/*.json5',
40+
'**/*.jsonc',
41+
'**/*.vue'
42+
]
43+
},
44+
{
45+
rules: {
46+
'no-case-declarations': 'off',
47+
'@typescript-eslint/no-unsafe-assignment': 'off',
48+
'@typescript-eslint/no-unsafe-call': 'off',
49+
'@typescript-eslint/no-unsafe-member-access': 'off',
50+
'@typescript-eslint/no-unsafe-argument': 'off',
51+
'@typescript-eslint/no-unsafe-return': 'off',
52+
'@typescript-eslint/ban-ts-comment': 'off',
53+
'@typescript-eslint/await-thenable': 'off',
54+
'@typescript-eslint/no-floating-promises': 'off',
55+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
56+
'@typescript-eslint/no-explicit-any': 'off',
57+
'@typescript-eslint/require-await': 'off',
58+
'@typescript-eslint/no-unused-expressions': 'off',
59+
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
60+
'@typescript-eslint/no-unsafe-function-type': 'off'
61+
}
62+
}
63+
)

package.json

+13-14
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
}
2424
},
2525
"devDependencies": {
26+
"@eslint/js": "^9.14.0",
2627
"@intlify/core-base": "next",
28+
"@kazupon/eslint-config": "^0.18.0",
2729
"@kazupon/lerna-changelog": "^4.3.0",
2830
"@octokit/rest": "^20.0.0",
2931
"@rollup/plugin-alias": "^3.1.5",
@@ -32,8 +34,7 @@
3234
"@rollup/plugin-replace": "^2.4.2",
3335
"@rollup/pluginutils": "^4.1.0",
3436
"@types/debug": "^4.1.5",
35-
"@types/eslint": "^8.56.10",
36-
"@types/eslint-visitor-keys": "^1.0.0",
37+
"@types/eslint": "^9.6.1",
3738
"@types/js-yaml": "^4.0.3",
3839
"@types/jsdom": "^16.2.5",
3940
"@types/json5": "^2.2.0",
@@ -43,17 +44,13 @@
4344
"@types/semver": "^7.3.6",
4445
"@types/webpack": "^5.28.2",
4546
"@types/webpack-merge": "^5.0.0",
46-
"@typescript-eslint/eslint-plugin": "^6.21.0",
47-
"@typescript-eslint/parser": "^6.21.0",
4847
"@vitejs/plugin-vue": "^5.1.4",
4948
"@vue/compiler-sfc": "^3.2.25",
5049
"babel-loader": "^8.2.2",
5150
"chalk": "^5.3.0",
5251
"debug": "^4.1.1",
53-
"eslint": "^8.57.0",
52+
"eslint": "^9.14.0",
5453
"eslint-config-prettier": "^9.1.0",
55-
"eslint-plugin-prettier": "^5.1.3",
56-
"eslint-plugin-vue": "^9.26.0",
5754
"execa": "^5.1.1",
5855
"get-port-please": "^3.1.2",
5956
"jiti": "^2.4.0",
@@ -63,15 +60,16 @@
6360
"minimist": "^1.2.8",
6461
"npm-run-all2": "^7.0.1",
6562
"opener": "^1.5.2",
63+
"playwright": "^1.44.0",
6664
"prettier": "^3.2.5",
6765
"prompts": "^2.4.2",
68-
"playwright": "^1.44.0",
6966
"rollup": "^2.53.1",
7067
"rollup-plugin-vue": "^6.0.0",
7168
"serve": "^11.3.2",
7269
"source-map": "0.6.1",
7370
"tiny-glob": "^0.2.9",
7471
"typescript": "^5.6.3",
72+
"typescript-eslint": "^8.13.0",
7573
"vite": "^5.4.10",
7674
"vitest": "^2.1.4",
7775
"vue": "^3.2.25",
@@ -122,12 +120,13 @@
122120
"clean:webpack": "pnpm --filter @intlify/vue-i18n-loader clean",
123121
"clean:unplugin": "pnpm --filter @intlify/unplugin-vue-i18n clean",
124122
"coverage": "opener coverage/lcov-report/index.html",
125-
"fix": "run-p lint:eslint:fix format:fix",
126-
"format": "prettier --config .prettierrc --ignore-path .prettierignore '**/*.{js,json,html}'",
127-
"format:fix": "pnpm format --write",
128-
"lint": "run-p lint:eslint",
129-
"lint:eslint": "eslint ./packages ./scripts --ext .ts",
130-
"lint:eslint:fix": "pnpm lint:eslint --fix",
123+
"fix": "run-p \"fix:* {@}\" --",
124+
"fix:eslint": "eslint --flag unstable_ts_config . --fix",
125+
"fix:prettier": "prettier . --write",
126+
"dev:lint": "pnpx @eslint/config-inspector --config eslint.config.ts",
127+
"lint": "run-p \"lint:* {@}\" --",
128+
"lint:eslint": "eslint --flag unstable_ts_config .",
129+
"lint:prettier": "prettier . --check",
131130
"test": "pnpm test:unit && pnpm test:e2e",
132131
"test:e2e": "pnpm check-install && vitest -c ./vitest.e2e.config.ts run",
133132
"test:e2e:rollup": "pnpm --filter @intlify/rollup-plugin-vue-i18n test:e2e",

packages/bundle-utils/src/codegen.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function advancePositionWithSource(
241241
}
242242

243243
const DETECT_MESSAGE = `Detected HTML in '{msg}' message.`
244-
const ON_ERROR_NOOP = () => {} // eslint-disable-line @typescript-eslint/no-empty-function
244+
const ON_ERROR_NOOP = () => {}
245245

246246
function parsePath(path?: string[]): string {
247247
return path ? path.join('.') : ''
@@ -371,11 +371,10 @@ export function mapLinesColumns(
371371
})
372372
})
373373

374-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
375374
const generator = mergedMapGenerator as any
376375
// const targetConsumer = inMapConsumer || resMapConsumer
377376
const targetConsumer = inMapConsumer || resMapConsumer
378-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
377+
379378
;(targetConsumer as any).sources.forEach((sourceFile: string) => {
380379
generator._sources.add(sourceFile)
381380
const sourceContent = targetConsumer.sourceContentFor(sourceFile)

packages/bundle-utils/src/deps.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export type InstalledPackage = 'vue-i18n' | 'petite-vue-i18n'
44

55
const _require = module.createRequire(import.meta.url)
66

7-
// eslint-disable-next-line @typescript-eslint/ban-types
87
export function checkInstallPackage(
98
pkg: string,
109
debug: Function
@@ -55,7 +54,6 @@ export function getVueI18nVersion(
5554
return 'unknown'
5655
}
5756

58-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5957
export function loadModule(moduleName: string, debug: Function): any {
6058
try {
6159
return _require(moduleName)

packages/bundle-utils/src/js.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function generate(
113113
// }
114114
// prettier-ignore
115115
const newMap = map
116-
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
116+
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null
117117
: null
118118
return {
119119
ast,

packages/bundle-utils/src/json.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function generate(
100100
// prettier-ignore
101101
const newMap =
102102
map && !jit
103-
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
103+
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null
104104
: null
105105
return {
106106
ast,

packages/bundle-utils/src/yaml.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function generate(
9393
const { code, map } = generator.context()
9494
// prettier-ignore
9595
const newMap = map
96-
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null // eslint-disable-line @typescript-eslint/no-explicit-any
96+
? mapLinesColumns((map as any).toJSON(), codeMaps, inSourceMap) || null
9797
: null
9898
return {
9999
ast,

packages/bundle-utils/test/fixtures/codegen/complex.json5

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
{
2-
hi: "hi there!",
2+
hi: 'hi there!',
33
nested: {
4-
hello: "hello world!",
4+
hello: 'hello world!',
55
more: {
66
plural: "@.caml:{'no apples'} | {0} apple | {n} apples"
77
},
8-
list: "hi, {0} !"
8+
list: 'hi, {0} !'
99
},
1010
// comment
11-
"こんにちは": "こんにちは!",
12-
"single-quote": "I don't know!",
13-
emoji: "😺",
14-
unicode: "\u0041",
15-
"unicode-escape": "\\u0041",
16-
"backslash-single-quote": "\\'",
17-
"backslash-backslash": "\\\\",
18-
errors: [
19-
'ERROR1001', 'ERROR1002'
20-
],
11+
こんにちは: 'こんにちは!',
12+
'single-quote': "I don't know!",
13+
emoji: '😺',
14+
unicode: '\u0041',
15+
'unicode-escape': '\\u0041',
16+
'backslash-single-quote': "\\'",
17+
'backslash-backslash': '\\\\',
18+
errors: ['ERROR1001', 'ERROR1002'],
2119
complex: {
2220
warnings: [
2321
'NOTE: This is warning',
2422
{
25-
"named-waring": 'this is {type} warining'
23+
'named-waring': 'this is {type} warining'
2624
}
2725
]
2826
}

packages/bundle-utils/test/fixtures/codegen/complex.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
hi: hi there!
22
nested:
3-
"hello": "hello world!"
3+
'hello': 'hello world!'
44
more:
55
plural: "@.caml:{'no apples'} | {0} apple | {n} apples"
66
list: hi, {0} !
7-
こんにちは: "こんにちは!"
7+
こんにちは: 'こんにちは!'
88
single-quote: "I don't know!"
99
emoji: 😺
1010
unicode: "\u0041"
@@ -17,4 +17,4 @@ errors:
1717
complex:
1818
warnings:
1919
- 'NOTE: This is warning'
20-
- named-waring: "this is {type} warining"
20+
- named-waring: 'this is {type} warining'

packages/bundle-utils/test/fixtures/codegen/complex.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
hi: hi there!
22
nested:
3-
"hello": "hello world!"
3+
'hello': 'hello world!'
44
more:
55
plural: "@.caml:{'no apples'} | {0} apple | {n} apples"
66
list: hi, {0} !
7-
こんにちは: "こんにちは!"
7+
こんにちは: 'こんにちは!'
88
single-quote: "I don't know!"
99
emoji: 😺
1010
unicode: "\u0041"
@@ -17,4 +17,4 @@ errors:
1717
complex:
1818
warnings:
1919
- 'NOTE: This is warning'
20-
- named-waring: "this is {type} warining"
20+
- named-waring: 'this is {type} warining'

0 commit comments

Comments
 (0)