chore: update deps, migrate tests
This commit is contained in:
parent
3a2c549110
commit
49b9b7f7db
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.6.7",
|
"packageManager": "pnpm@8.6.12",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite-ssg build",
|
"build": "vite-ssg build",
|
||||||
"dev": "vite --port 3333 --open",
|
"dev": "vite --port 3333 --open",
|
||||||
@ -15,48 +15,48 @@
|
|||||||
"up": "taze major -I"
|
"up": "taze major -I"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@unocss/reset": "^0.53.5",
|
"@unocss/reset": "^0.54.2",
|
||||||
"@vueuse/core": "^10.2.1",
|
"@vueuse/core": "^10.3.0",
|
||||||
"@vueuse/head": "^1.1.26",
|
"@vueuse/head": "^1.1.26",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.1.4",
|
"pinia": "^2.1.6",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-demi": "^0.14.5",
|
"vue-demi": "^0.14.5",
|
||||||
"vue-i18n": "^9.2.2",
|
"vue-i18n": "^9.2.2",
|
||||||
"vue-router": "^4.2.4"
|
"vue-router": "^4.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^0.39.7",
|
"@antfu/eslint-config": "^0.40.0",
|
||||||
"@iconify-json/carbon": "^1.1.18",
|
"@iconify-json/carbon": "^1.1.19",
|
||||||
"@intlify/vite-plugin-vue-i18n": "^7.0.0",
|
"@intlify/vite-plugin-vue-i18n": "^7.0.0",
|
||||||
"@types/markdown-it-link-attributes": "^3.0.1",
|
"@types/markdown-it-link-attributes": "^3.0.1",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@vitejs/plugin-vue": "^4.2.3",
|
||||||
"@vue/test-utils": "^2.4.0",
|
"@vue/test-utils": "^2.4.1",
|
||||||
"critters": "^0.0.19",
|
"critters": "^0.0.20",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cypress": "^12.17.1",
|
"cypress": "^12.17.3",
|
||||||
"eslint": "^8.45.0",
|
"eslint": "^8.46.0",
|
||||||
"eslint-plugin-cypress": "^2.13.3",
|
"eslint-plugin-cypress": "^2.13.3",
|
||||||
"https-localhost": "^4.7.1",
|
"https-localhost": "^4.7.1",
|
||||||
"markdown-it-link-attributes": "^4.0.1",
|
"markdown-it-link-attributes": "^4.0.1",
|
||||||
"markdown-it-shiki": "^0.9.0",
|
"markdown-it-shiki": "^0.9.0",
|
||||||
"pnpm": "^8.6.7",
|
"pnpm": "^8.6.12",
|
||||||
"shiki": "^0.14.3",
|
"shiki": "^0.14.3",
|
||||||
"taze": "^0.11.2",
|
"taze": "^0.11.2",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"unocss": "^0.53.5",
|
"unocss": "^0.54.2",
|
||||||
"unplugin-auto-import": "^0.16.6",
|
"unplugin-auto-import": "^0.16.6",
|
||||||
"unplugin-vue-components": "^0.25.1",
|
"unplugin-vue-components": "^0.25.1",
|
||||||
"vite": "^4.4.4",
|
"vite": "^4.4.9",
|
||||||
"vite-plugin-inspect": "^0.7.33",
|
"vite-plugin-inspect": "^0.7.35",
|
||||||
"vite-plugin-pages": "^0.31.0",
|
"vite-plugin-pages": "^0.31.0",
|
||||||
"vite-plugin-pwa": "^0.16.4",
|
"vite-plugin-pwa": "^0.16.4",
|
||||||
"vite-plugin-vue-layouts": "^0.8.0",
|
"vite-plugin-vue-layouts": "^0.8.0",
|
||||||
"vite-plugin-vue-markdown": "^0.23.5",
|
"vite-plugin-vue-markdown": "^0.23.7",
|
||||||
"vite-ssg": "^0.23.0",
|
"vite-ssg": "^0.23.1",
|
||||||
"vite-ssg-sitemap": "^0.5.1",
|
"vite-ssg-sitemap": "^0.5.1",
|
||||||
"vitest": "^0.33.0",
|
"vitest": "^0.34.1",
|
||||||
"vue-tsc": "^1.8.5"
|
"vue-tsc": "^1.8.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "@antfu/eslint-config-monorepo",
|
"name": "@antfu/eslint-config-monorepo",
|
||||||
"version": "0.40.0",
|
"version": "0.40.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.6.7",
|
"packageManager": "pnpm@8.6.12",
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -15,7 +15,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "workspace:*",
|
"@antfu/eslint-config": "workspace:*",
|
||||||
"bumpp": "^9.1.1",
|
"bumpp": "^9.1.1",
|
||||||
"eslint": "^8.45.0",
|
"eslint": "^8.46.0",
|
||||||
"eslint-plugin-antfu": "link:./packages/eslint-plugin-antfu",
|
"eslint-plugin-antfu": "link:./packages/eslint-plugin-antfu",
|
||||||
"rimraf": "^5.0.1",
|
"rimraf": "^5.0.1",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
|
@ -22,19 +22,19 @@
|
|||||||
"eslint-plugin-antfu": "workspace:*",
|
"eslint-plugin-antfu": "workspace:*",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
"eslint-plugin-html": "^7.1.0",
|
"eslint-plugin-html": "^7.1.0",
|
||||||
"eslint-plugin-import": "npm:eslint-plugin-i@2.27.5-4",
|
"eslint-plugin-import": "npm:eslint-plugin-i@2.28.0",
|
||||||
"eslint-plugin-jsonc": "^2.9.0",
|
"eslint-plugin-jsonc": "^2.9.0",
|
||||||
"eslint-plugin-markdown": "^3.0.0",
|
"eslint-plugin-markdown": "^3.0.1",
|
||||||
"eslint-plugin-n": "^16.0.1",
|
"eslint-plugin-n": "^16.0.1",
|
||||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-unicorn": "^48.0.0",
|
"eslint-plugin-unicorn": "^48.0.1",
|
||||||
"eslint-plugin-unused-imports": "^3.0.0",
|
"eslint-plugin-unused-imports": "^3.0.0",
|
||||||
"eslint-plugin-yml": "^1.8.0",
|
"eslint-plugin-yml": "^1.8.0",
|
||||||
"jsonc-eslint-parser": "^2.3.0",
|
"jsonc-eslint-parser": "^2.3.0",
|
||||||
"yaml-eslint-parser": "^1.2.2"
|
"yaml-eslint-parser": "^1.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0"
|
"eslint": "^8.46.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-ts": "workspace:*",
|
"@antfu/eslint-config-ts": "workspace:*",
|
||||||
"eslint-plugin-react": "^7.32.2",
|
"eslint-plugin-react": "^7.33.1",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0"
|
"eslint-plugin-react-hooks": "^4.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0",
|
"eslint": "^8.46.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-basic": "workspace:*",
|
"@antfu/eslint-config-basic": "workspace:*",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.2.1",
|
||||||
"eslint-plugin-jest": "^27.2.3"
|
"eslint-plugin-jest": "^27.2.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0"
|
"eslint": "^8.46.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-basic": "workspace:*",
|
"@antfu/eslint-config-basic": "workspace:*",
|
||||||
"@antfu/eslint-config-ts": "workspace:*",
|
"@antfu/eslint-config-ts": "workspace:*",
|
||||||
"eslint-plugin-vue": "^9.15.1",
|
"eslint-plugin-vue": "^9.16.1",
|
||||||
"local-pkg": "^0.4.3"
|
"local-pkg": "^0.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0"
|
"eslint": "^8.46.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,21 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@antfu/eslint-config-vue": "workspace:*",
|
"@antfu/eslint-config-vue": "workspace:*",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.2.1",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
"eslint-plugin-html": "^7.1.0",
|
"eslint-plugin-html": "^7.1.0",
|
||||||
"eslint-plugin-import": "npm:eslint-plugin-i@2.27.5-4",
|
"eslint-plugin-import": "npm:eslint-plugin-i@2.28.0",
|
||||||
"eslint-plugin-jsonc": "^2.9.0",
|
"eslint-plugin-jsonc": "^2.9.0",
|
||||||
"eslint-plugin-n": "^16.0.1",
|
"eslint-plugin-n": "^16.0.1",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-unicorn": "^48.0.0",
|
"eslint-plugin-unicorn": "^48.0.1",
|
||||||
"eslint-plugin-vue": "^9.15.1",
|
"eslint-plugin-vue": "^9.16.1",
|
||||||
"eslint-plugin-yml": "^1.8.0",
|
"eslint-plugin-yml": "^1.8.0",
|
||||||
"jsonc-eslint-parser": "^2.3.0",
|
"jsonc-eslint-parser": "^2.3.0",
|
||||||
"yaml-eslint-parser": "^1.2.2"
|
"yaml-eslint-parser": "^1.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.45.0"
|
"eslint": "^8.46.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ export default defineBuildConfig({
|
|||||||
entries: [
|
entries: [
|
||||||
'src/index',
|
'src/index',
|
||||||
],
|
],
|
||||||
declaration: true,
|
declaration: false,
|
||||||
clean: true,
|
clean: true,
|
||||||
rollup: {
|
rollup: {
|
||||||
emitCJS: true,
|
emitCJS: true,
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
"homepage": "https://github.com/antfu/eslint-config",
|
"homepage": "https://github.com/antfu/eslint-config",
|
||||||
"main": "./dist/index.cjs",
|
"main": "./dist/index.cjs",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
@ -16,11 +15,12 @@
|
|||||||
"prepublishOnly": "nr build"
|
"prepublishOnly": "nr build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/utils": "^6.0.0"
|
"@typescript-eslint/utils": "^6.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.4.2",
|
"@types/node": "^20.4.8",
|
||||||
|
"@typescript-eslint/rule-tester": "^6.2.1",
|
||||||
"unbuild": "^1.2.1",
|
"unbuild": "^1.2.1",
|
||||||
"vitest": "^0.33.0"
|
"vitest": "^0.34.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './generic-spacing'
|
import rule, { RULE_NAME } from './generic-spacing'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -36,12 +35,11 @@ const invalids = [
|
|||||||
}`],
|
}`],
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i[0],
|
code: i[0],
|
||||||
@ -49,4 +47,3 @@ it('runs', () => {
|
|||||||
errors: Array.from({ length: i[2] || 1 }, () => ({ messageId: 'genericSpacingMismatch' })),
|
errors: Array.from({ length: i[2] || 1 }, () => ({ messageId: 'genericSpacingMismatch' })),
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'suggestion',
|
type: 'suggestion',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Spaces around generic type parameters',
|
description: 'Spaces around generic type parameters',
|
||||||
recommended: 'error',
|
recommended: 'stylistic',
|
||||||
},
|
},
|
||||||
fixable: 'code',
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './if-newline'
|
import rule, { RULE_NAME } from './if-newline'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -14,12 +13,11 @@ const invalids = [
|
|||||||
['if (true) console.log(\'hello\')', 'if (true) \nconsole.log(\'hello\')'],
|
['if (true) console.log(\'hello\')', 'if (true) \nconsole.log(\'hello\')'],
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i[0],
|
code: i[0],
|
||||||
@ -27,4 +25,3 @@ it('runs', () => {
|
|||||||
errors: [{ messageId: 'missingIfNewline' }],
|
errors: [{ messageId: 'missingIfNewline' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Newline after if',
|
description: 'Newline after if',
|
||||||
recommended: 'error',
|
recommended: 'stylistic',
|
||||||
},
|
},
|
||||||
fixable: 'code',
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './import-dedupe'
|
import rule, { RULE_NAME } from './import-dedupe'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -12,12 +11,11 @@ const invalids = [
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i[0],
|
code: i[0],
|
||||||
@ -25,4 +23,3 @@ it('runs', () => {
|
|||||||
errors: [{ messageId: 'importDedupe' }, { messageId: 'importDedupe' }, { messageId: 'importDedupe' }],
|
errors: [{ messageId: 'importDedupe' }, { messageId: 'importDedupe' }, { messageId: 'importDedupe' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Fix duplication in imports',
|
description: 'Fix duplication in imports',
|
||||||
recommended: 'error',
|
recommended: 'strict',
|
||||||
},
|
},
|
||||||
fixable: 'code',
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './named-tuple-spacing'
|
import rule, { RULE_NAME } from './named-tuple-spacing'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
'type T = [i: number]',
|
'type T = [i: number]',
|
||||||
'type T = [i?: number]',
|
'type T = [i?: number]',
|
||||||
'type T = [i: number, j: number]',
|
'type T = [i: number, j: number]',
|
||||||
|
'type T = [i: number, j: () => string]',
|
||||||
`const emit = defineEmits<{
|
`const emit = defineEmits<{
|
||||||
change: [id: number]
|
change: [id: number]
|
||||||
update: [value: string]
|
update: [value: string]
|
||||||
}>()`,
|
}>()`,
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: [
|
invalid: [
|
||||||
{
|
{
|
||||||
@ -60,6 +59,11 @@ it('runs', () => {
|
|||||||
output: 'type T = [i: number, j: number]',
|
output: 'type T = [i: number, j: number]',
|
||||||
errors: [{ messageId: 'expectedSpaceAfter' }, { messageId: 'expectedSpaceAfter' }],
|
errors: [{ messageId: 'expectedSpaceAfter' }, { messageId: 'expectedSpaceAfter' }],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
code: 'type T = [i:()=>void, j:number]',
|
||||||
|
output: 'type T = [i: ()=>void, j: number]',
|
||||||
|
errors: [{ messageId: 'expectedSpaceAfter' }, { messageId: 'expectedSpaceAfter' }],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
code: `
|
code: `
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@ -92,4 +96,3 @@ it('runs', () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './no-cjs-exports'
|
import rule, { RULE_NAME } from './no-cjs-exports'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -13,16 +12,14 @@ const invalids = [
|
|||||||
{ code: 'module.exports.a = {}', filename: 'test.ts' },
|
{ code: 'module.exports.a = {}', filename: 'test.ts' },
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
...i,
|
...i,
|
||||||
errors: [{ messageId: 'noCjsExports' }],
|
errors: [{ messageId: 'noCjsExports' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,6 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Do not use CJS exports',
|
description: 'Do not use CJS exports',
|
||||||
recommended: false,
|
|
||||||
},
|
},
|
||||||
schema: [],
|
schema: [],
|
||||||
messages: {
|
messages: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './no-const-enum'
|
import rule, { RULE_NAME } from './no-const-enum'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -10,16 +9,14 @@ const invalids = [
|
|||||||
'const enum E {}',
|
'const enum E {}',
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i,
|
code: i,
|
||||||
errors: [{ messageId: 'noConstEnum' }],
|
errors: [{ messageId: 'noConstEnum' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Disallow using `const enum` expression',
|
description: 'Disallow using `const enum` expression',
|
||||||
recommended: 'error',
|
recommended: 'recommended',
|
||||||
},
|
},
|
||||||
schema: [],
|
schema: [],
|
||||||
messages: {
|
messages: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './no-import-node-modules-by-path'
|
import rule, { RULE_NAME } from './no-import-node-modules-by-path'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -16,16 +15,14 @@ const invalids = [
|
|||||||
'require("../node_modules/d")',
|
'require("../node_modules/d")',
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i,
|
code: i,
|
||||||
errors: [{ messageId: 'noImportNodeModulesByPath' }],
|
errors: [{ messageId: 'noImportNodeModulesByPath' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Prevent importing modules in `node_modules` folder by relative or absolute path',
|
description: 'Prevent importing modules in `node_modules` folder by relative or absolute path',
|
||||||
recommended: 'error',
|
recommended: 'recommended',
|
||||||
},
|
},
|
||||||
schema: [],
|
schema: [],
|
||||||
messages: {
|
messages: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './no-ts-export-equal'
|
import rule, { RULE_NAME } from './no-ts-export-equal'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -11,16 +10,14 @@ const invalids = [
|
|||||||
{ code: 'export = {}', filename: 'test.ts' },
|
{ code: 'export = {}', filename: 'test.ts' },
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
...i,
|
...i,
|
||||||
errors: [{ messageId: 'noTsExportEqual' }],
|
errors: [{ messageId: 'noTsExportEqual' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Do not use `exports =`',
|
description: 'Do not use `exports =`',
|
||||||
recommended: false,
|
recommended: 'recommended',
|
||||||
},
|
},
|
||||||
schema: [],
|
schema: [],
|
||||||
messages: {
|
messages: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './prefer-inline-type-import'
|
import rule, { RULE_NAME } from './prefer-inline-type-import'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -12,12 +11,11 @@ const invalids = [
|
|||||||
['import type { Foo } from \'foo\'', 'import { type Foo } from \'foo\''],
|
['import type { Foo } from \'foo\'', 'import { type Foo } from \'foo\''],
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i[0],
|
code: i[0],
|
||||||
@ -25,4 +23,3 @@ it('runs', () => {
|
|||||||
errors: [{ messageId: 'preferInlineTypeImport' }],
|
errors: [{ messageId: 'preferInlineTypeImport' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Ported from https://github.com/gajus/eslint-plugin-canonical/blob/master/src/rules/preferInlineTypeImport.js
|
// Ported from https://github.com/gajus/eslint-plugin-canonical/blob/master/src/rules/preferInlineTypeImport.js
|
||||||
// by Gajus Kuizinas https://github.com/gajus
|
// by Gajus Kuizinas https://github.com/gajus
|
||||||
import type { TSESTree } from '@typescript-eslint/utils'
|
import type { TSESTree } from '@typescript-eslint/utils'
|
||||||
import type { RuleFixer, SourceCode } from '@typescript-eslint/utils/dist/ts-eslint'
|
import type { RuleFixer, SourceCode } from '@typescript-eslint/utils/ts-eslint'
|
||||||
import { createEslintRule } from '../utils'
|
import { createEslintRule } from '../utils'
|
||||||
|
|
||||||
export const RULE_NAME = 'prefer-inline-type-import'
|
export const RULE_NAME = 'prefer-inline-type-import'
|
||||||
@ -14,7 +14,6 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'suggestion',
|
type: 'suggestion',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Inline type import',
|
description: 'Inline type import',
|
||||||
recommended: 'error',
|
|
||||||
},
|
},
|
||||||
fixable: 'code',
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { RuleTester } from '@typescript-eslint/utils/dist/ts-eslint'
|
import { RuleTester } from '@typescript-eslint/rule-tester'
|
||||||
import { it } from 'vitest'
|
|
||||||
import rule, { RULE_NAME } from './top-level-function'
|
import rule, { RULE_NAME } from './top-level-function'
|
||||||
|
|
||||||
const valids = [
|
const valids = [
|
||||||
@ -51,12 +50,11 @@ const invalids = [
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
it('runs', () => {
|
|
||||||
const ruleTester: RuleTester = new RuleTester({
|
const ruleTester: RuleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
parser: require.resolve('@typescript-eslint/parser'),
|
||||||
})
|
})
|
||||||
|
|
||||||
ruleTester.run(RULE_NAME, rule, {
|
ruleTester.run(RULE_NAME, rule as any, {
|
||||||
valid: valids,
|
valid: valids,
|
||||||
invalid: invalids.map(i => ({
|
invalid: invalids.map(i => ({
|
||||||
code: i[0],
|
code: i[0],
|
||||||
@ -64,4 +62,3 @@ it('runs', () => {
|
|||||||
errors: [{ messageId: 'topLevelFunctionDeclaration' }],
|
errors: [{ messageId: 'topLevelFunctionDeclaration' }],
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
@ -10,7 +10,7 @@ export default createEslintRule<Options, MessageIds>({
|
|||||||
type: 'problem',
|
type: 'problem',
|
||||||
docs: {
|
docs: {
|
||||||
description: 'Enforce top-level functions to be declared with function keyword',
|
description: 'Enforce top-level functions to be declared with function keyword',
|
||||||
recommended: 'error',
|
recommended: 'stylistic',
|
||||||
},
|
},
|
||||||
fixable: 'code',
|
fixable: 'code',
|
||||||
schema: [],
|
schema: [],
|
||||||
|
7
packages/eslint-plugin-antfu/vitest.config.ts
Normal file
7
packages/eslint-plugin-antfu/vitest.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
},
|
||||||
|
})
|
663
pnpm-lock.yaml
663
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,8 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"module": "es2020",
|
"module": "es2020",
|
||||||
"moduleResolution": "node"
|
"moduleResolution": "Bundler",
|
||||||
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./packages/**/*.ts"
|
"./packages/**/*.ts"
|
||||||
|
Loading…
Reference in New Issue
Block a user