Compare commits

...

10 Commits

Author SHA1 Message Date
Anthony Fu
500fe9df8d chore: release v0.39.8 2023-07-16 00:20:35 +02:00
Anthony Fu
5be2b3fd39 chore: update deps 2023-07-16 00:20:31 +02:00
三咲智子 Kevin Deng
5821926148 fix(plugin): allow empty type import (#218) 2023-07-16 00:18:20 +02:00
曾明健
3ef955d56f feat(basic): prefer non global process object (#214) 2023-07-12 12:39:07 +02:00
Marshall Thompson
1b25322bf5 docs: VS Code config example (#215) 2023-07-10 03:02:20 +02:00
曾明健
2ed8536b85 feat(basic): ban self import (#213) 2023-07-05 11:50:02 +02:00
Anthony Fu
4edff9cd15 chore: release v0.39.7 2023-07-04 11:32:56 +02:00
Anthony Fu
f245939bfa chore: update deps 2023-07-04 11:32:40 +02:00
曾明健
be5bc8009c feat: ban new Array (#209) 2023-07-04 10:52:53 +02:00
曾明健
d4a9ebcc17 feat(ts): enable @typescript-eslint/ban-types (#210) 2023-07-03 21:19:59 +02:00
14 changed files with 673 additions and 579 deletions

View File

@@ -53,25 +53,25 @@ Add the following settings to your `settings.json`:
"editor.formatOnSave": false, "editor.formatOnSave": false,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": true, "source.fixAll.eslint": true,
"source.organizeImports": false, "source.organizeImports": false
},
// The following is optional. // The following is optional.
// It's better to put under project setting `.vscode/settings.json` // It's better to put under project setting `.vscode/settings.json`
// to avoid conflicts with working with different eslint configs // to avoid conflicts with working with different eslint configs
// that does not support all formats. // that does not support all formats.
"eslint.validate": [ "eslint.validate": [
"javascript", "javascript",
"javascriptreact", "javascriptreact",
"typescript", "typescript",
"typescriptreact", "typescriptreact",
"vue", "vue",
"html", "html",
"markdown", "markdown",
"json", "json",
"jsonc", "jsonc",
"yaml" "yaml"
] ]
}
} }
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"type": "module", "type": "module",
"private": true, "private": true,
"packageManager": "pnpm@8.5.1", "packageManager": "pnpm@8.6.7",
"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.52.1", "@unocss/reset": "^0.53.5",
"@vueuse/core": "^10.1.2", "@vueuse/core": "^10.2.1",
"@vueuse/head": "^1.1.26", "@vueuse/head": "^1.1.26",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.1.3", "pinia": "^2.1.4",
"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.1" "vue-router": "^4.2.4"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.39.1", "@antfu/eslint-config": "^0.39.7",
"@iconify-json/carbon": "^1.1.16", "@iconify-json/carbon": "^1.1.18",
"@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.3.2", "@vue/test-utils": "^2.4.0",
"critters": "^0.0.16", "critters": "^0.0.19",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cypress": "^12.12.0", "cypress": "^12.17.1",
"eslint": "^8.41.0", "eslint": "^8.45.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.5.1", "pnpm": "^8.6.7",
"shiki": "^0.14.2", "shiki": "^0.14.3",
"taze": "^0.10.1", "taze": "^0.11.2",
"typescript": "^5.0.4", "typescript": "^5.1.6",
"unocss": "^0.52.1", "unocss": "^0.53.5",
"unplugin-auto-import": "^0.16.2", "unplugin-auto-import": "^0.16.6",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.25.1",
"vite": "^4.3.8", "vite": "^4.4.4",
"vite-plugin-inspect": "^0.7.26", "vite-plugin-inspect": "^0.7.33",
"vite-plugin-pages": "^0.30.1", "vite-plugin-pages": "^0.31.0",
"vite-plugin-pwa": "^0.15.0", "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.5",
"vite-ssg": "^0.22.2", "vite-ssg": "^0.23.0",
"vite-ssg-sitemap": "^0.5.1", "vite-ssg-sitemap": "^0.5.1",
"vitest": "^0.31.1", "vitest": "^0.33.0",
"vue-tsc": "^1.6.5" "vue-tsc": "^1.8.5"
} }
} }

View File

@@ -1,8 +1,8 @@
{ {
"name": "@antfu/eslint-config-monorepo", "name": "@antfu/eslint-config-monorepo",
"version": "0.39.6", "version": "0.39.8",
"private": true, "private": true,
"packageManager": "pnpm@8.5.1", "packageManager": "pnpm@8.6.7",
"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": {
@@ -14,10 +14,10 @@
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "workspace:*", "@antfu/eslint-config": "workspace:*",
"bumpp": "^9.1.0", "bumpp": "^9.1.1",
"eslint": "^8.41.0", "eslint": "^8.45.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.0.4" "typescript": "^5.1.6"
} }
} }

View File

@@ -204,6 +204,7 @@ module.exports = {
'no-unused-vars': 'off', 'no-unused-vars': 'off',
'antfu/no-cjs-exports': 'off', 'antfu/no-cjs-exports': 'off',
'antfu/no-ts-export-equal': 'off', 'antfu/no-ts-export-equal': 'off',
'n/prefer-global/process': 'off',
}, },
}, },
], ],
@@ -215,6 +216,7 @@ module.exports = {
'import/no-unresolved': 'off', 'import/no-unresolved': 'off',
'import/no-absolute-path': 'off', 'import/no-absolute-path': 'off',
'import/newline-after-import': ['error', { count: 1, considerComments: true }], 'import/newline-after-import': ['error', { count: 1, considerComments: true }],
'import/no-self-import': 'error',
// Common // Common
'semi': ['error', 'never'], 'semi': ['error', 'never'],
@@ -337,7 +339,7 @@ module.exports = {
'max-statements-per-line': ['error', { max: 1 }], 'max-statements-per-line': ['error', { max: 1 }],
// node // node
// 'n/prefer-global/process': ['error', 'never'], // Not sure if we need it as we are using `process.env.NODE_ENV` a lot in front-end. 'n/prefer-global/process': ['error', 'never'],
'n/prefer-global/buffer': ['error', 'never'], 'n/prefer-global/buffer': ['error', 'never'],
'n/no-callback-literal': 'off', 'n/no-callback-literal': 'off',
@@ -368,6 +370,8 @@ module.exports = {
'unicorn/prefer-node-protocol': 'error', 'unicorn/prefer-node-protocol': 'error',
// Prefer using number properties like `Number.isNaN` rather than `isNaN` // Prefer using number properties like `Number.isNaN` rather than `isNaN`
'unicorn/prefer-number-properties': 'error', 'unicorn/prefer-number-properties': 'error',
// Ban `new Array` as `Array` constructor's params are ambiguous
'unicorn/no-new-array': 'error',
'no-use-before-define': ['error', { functions: false, classes: false, variables: true }], 'no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
'eslint-comments/disable-enable-pair': 'off', 'eslint-comments/disable-enable-pair': 'off',

View File

@@ -1,6 +1,6 @@
{ {
"name": "@antfu/eslint-config-basic", "name": "@antfu/eslint-config-basic",
"version": "0.39.6", "version": "0.39.8",
"description": "", "description": "",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT", "license": "MIT",
@@ -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-3", "eslint-plugin-import": "npm:eslint-plugin-i@2.27.5-4",
"eslint-plugin-jsonc": "^2.8.0", "eslint-plugin-jsonc": "^2.9.0",
"eslint-plugin-markdown": "^3.0.0", "eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-n": "^16.0.0", "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": "^47.0.0", "eslint-plugin-unicorn": "^48.0.0",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^3.0.0",
"eslint-plugin-yml": "^1.7.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.41.0" "eslint": "^8.45.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@antfu/eslint-config-react", "name": "@antfu/eslint-config-react",
"version": "0.39.6", "version": "0.39.8",
"description": "", "description": "",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT", "license": "MIT",
@@ -24,8 +24,8 @@
"eslint-plugin-react-hooks": "^4.6.0" "eslint-plugin-react-hooks": "^4.6.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.41.0", "eslint": "^8.45.0",
"react": "^18.2.0", "react": "^18.2.0",
"typescript": "^5.0.4" "typescript": "^5.1.6"
} }
} }

View File

@@ -1,5 +1,6 @@
const fs = require('node:fs') const fs = require('node:fs')
const { join } = require('node:path') const { join } = require('node:path')
const process = require('node:process')
const basic = require('@antfu/eslint-config-basic') const basic = require('@antfu/eslint-config-basic')
const tsconfig = process.env.ESLINT_TSCONFIG || 'tsconfig.eslint.json' const tsconfig = process.env.ESLINT_TSCONFIG || 'tsconfig.eslint.json'
@@ -173,7 +174,6 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/triple-slash-reference': 'off', '@typescript-eslint/triple-slash-reference': 'off',
// handled by unused-imports/no-unused-imports // handled by unused-imports/no-unused-imports
'@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': 'off',

View File

@@ -1,6 +1,6 @@
{ {
"name": "@antfu/eslint-config-ts", "name": "@antfu/eslint-config-ts",
"version": "0.39.6", "version": "0.39.8",
"description": "", "description": "",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT", "license": "MIT",
@@ -18,11 +18,11 @@
}, },
"dependencies": { "dependencies": {
"@antfu/eslint-config-basic": "workspace:*", "@antfu/eslint-config-basic": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.59.7", "@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^5.59.7", "@typescript-eslint/parser": "^6.0.0",
"eslint-plugin-jest": "^27.2.1" "eslint-plugin-jest": "^27.2.3"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.41.0" "eslint": "^8.45.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@antfu/eslint-config-vue", "name": "@antfu/eslint-config-vue",
"version": "0.39.6", "version": "0.39.8",
"description": "", "description": "",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT", "license": "MIT",
@@ -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.14.0", "eslint-plugin-vue": "^9.15.1",
"local-pkg": "^0.4.3" "local-pkg": "^0.4.3"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.41.0" "eslint": "^8.45.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@antfu/eslint-config", "name": "@antfu/eslint-config",
"version": "0.39.6", "version": "0.39.8",
"description": "Anthony's ESLint config", "description": "Anthony's ESLint config",
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)", "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
"license": "MIT", "license": "MIT",
@@ -17,21 +17,21 @@
}, },
"dependencies": { "dependencies": {
"@antfu/eslint-config-vue": "workspace:*", "@antfu/eslint-config-vue": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.59.7", "@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^5.59.7", "@typescript-eslint/parser": "^6.0.0",
"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-3", "eslint-plugin-import": "npm:eslint-plugin-i@2.27.5-4",
"eslint-plugin-jsonc": "^2.8.0", "eslint-plugin-jsonc": "^2.9.0",
"eslint-plugin-n": "^16.0.0", "eslint-plugin-n": "^16.0.1",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^47.0.0", "eslint-plugin-unicorn": "^48.0.0",
"eslint-plugin-vue": "^9.14.0", "eslint-plugin-vue": "^9.15.1",
"eslint-plugin-yml": "^1.7.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.41.0" "eslint": "^8.45.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "eslint-plugin-antfu", "name": "eslint-plugin-antfu",
"version": "0.39.6", "version": "0.39.8",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/antfu/eslint-config", "homepage": "https://github.com/antfu/eslint-config",
"main": "./dist/index.cjs", "main": "./dist/index.cjs",
@@ -16,11 +16,11 @@
"prepublishOnly": "nr build" "prepublishOnly": "nr build"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "^5.59.7" "@typescript-eslint/utils": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.2.3", "@types/node": "^20.4.2",
"unbuild": "^1.2.1", "unbuild": "^1.2.1",
"vitest": "^0.31.1" "vitest": "^0.33.0"
} }
} }

View File

@@ -6,6 +6,7 @@ const valids = [
'import { type Foo } from \'foo\'', 'import { type Foo } from \'foo\'',
'import type Foo from \'foo\'', 'import type Foo from \'foo\'',
'import type * as Foo from \'foo\'', 'import type * as Foo from \'foo\'',
'import type {} from \'foo\'',
] ]
const invalids = [ const invalids = [
['import type { Foo } from \'foo\'', 'import { type Foo } from \'foo\''], ['import type { Foo } from \'foo\'', 'import { type Foo } from \'foo\''],

View File

@@ -30,7 +30,7 @@ export default createEslintRule<Options, MessageIds>({
// ignore bare type imports // ignore bare type imports
if (node.specifiers.length === 1 && ['ImportNamespaceSpecifier', 'ImportDefaultSpecifier'].includes(node.specifiers[0].type)) if (node.specifiers.length === 1 && ['ImportNamespaceSpecifier', 'ImportDefaultSpecifier'].includes(node.specifiers[0].type))
return return
if (node.importKind === 'type') { if (node.importKind === 'type' && node.specifiers.length > 0) {
context.report({ context.report({
*fix(fixer) { *fix(fixer) {
yield * removeTypeSpecifier(fixer, sourceCode, node) yield * removeTypeSpecifier(fixer, sourceCode, node)

1079
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff