wip: new eslint config

This commit is contained in:
07akioni 2024-07-12 00:48:52 +08:00
parent 1313ce31a5
commit 30d25339c5
5 changed files with 121 additions and 203 deletions

View File

@ -1,6 +0,0 @@
node_modules
lib
test/unit/coverage
src/_deprecated/icons
dist
es

View File

@ -1,98 +0,0 @@
module.exports = {
extends: ['plugin:markdown/recommended-legacy', 'prettier'],
overrides: [
{
files: '*.mjs',
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest'
}
},
{
files: '*.vue',
extends: [
'@vue/typescript/recommended',
'plugin:vue/vue3-recommended',
'@vue/typescript'
]
},
{
files: ['*.vue', '*.js'],
extends: ['plugin:vue/essential', '@vue/standard'],
rules: {
'vue/multiline-html-element-content-newline': 0,
'vue/multi-word-component-names': 0,
'vue/max-attributes-per-line': [
2,
{
singleline: 20,
multiline: 1
}
],
'vue/require-default-prop': 0,
'vue/no-multiple-template-root': 0,
'vue/no-lone-template': 0,
'vue/no-v-model-argument': 0,
'vue/one-component-per-file': 0,
'import/no-cycle': 1
}
},
{
files: ['*.ts', '*.tsx'],
extends: ['love', 'plugin:import/typescript'],
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true
}
},
rules: {
'@typescript-eslint/strict-boolean-expressions': 0,
'@typescript-eslint/prefer-nullish-coalescing': 0,
'@typescript-eslint/naming-convention': 0,
'multiline-ternary': 0,
'no-void': 0,
'import/no-cycle': 1
}
},
{
files: ['light.ts'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/explicit-function-return-type': 0
}
},
{
files: '**/*.md/*.js',
rules: {
'no-undef': 0
}
},
{
files: ['**/*.md/*.ts'],
processor: 'markdown/markdown',
rules: {
'import/order': 0,
'prettier/prettier': 0,
'@typescript-eslint/consistent-type-definitions': 0
}
},
{
files: ['*.spec.ts', '*.spec.js'],
globals: {
describe: 'readonly',
it: 'readonly',
expect: 'readonly'
},
rules: {
'@typescript-eslint/no-floating-promises': 0
}
},
{
files: '*',
globals: {
__DEV__: 'readonly'
}
}
]
}

35
eslint.config.mjs Normal file
View File

@ -0,0 +1,35 @@
import antfu from '@antfu/eslint-config'
export default antfu(
{
regexp: false,
ignores: [
'node_modules',
'lib',
'test/unit/coverage',
'src/_deprecated/icons',
'dist',
'es',
],
},
{
files: ['**/*.demo.vue'],
rules: {
'no-console': 'off',
'vue/one-component-per-file': 'off',
},
},
{
files: ['**/*.tsx'],
rules: {
'unused-imports/no-unused-imports': 'off',
},
},
{
files: ['**/*'],
rules: {
'style/multiline-ternary': 'off',
'style/max-statements-per-line': 'off',
},
},
)

View File

@ -2,11 +2,34 @@
"name": "naive-ui",
"version": "2.38.2",
"description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
"author": "07akioni",
"license": "MIT",
"homepage": "https://www.naiveui.com",
"repository": {
"type": "git",
"url": "https://github.com/tusen-ai/naive-ui"
},
"keywords": [
"naive-ui",
"component library",
"ui framework",
"ui",
"vue"
],
"sideEffects": false,
"main": "lib/index.js",
"module": "es/index.mjs",
"types": "es/index.d.ts",
"unpkg": "dist/index.js",
"jsdelivr": "dist/index.js",
"types": "es/index.d.ts",
"files": [
"README.md",
"dist",
"es",
"lib",
"volar.d.ts",
"web-types.json"
],
"scripts": {
"start": "pnpm run dev",
"dev": "pnpm run clean && pnpm run gen-version && pnpm run gen-volar-dts && NODE_ENV=development vite",
@ -37,45 +60,34 @@
"transpile-docs": "node scripts/md-to-vue data-table",
"release:site": "TUSIMPLE=true pnpm run build:site && node build-doc/generate-deploy-sh.js && sudo bash build-doc/deploy-doc.sh"
},
"author": "07akioni",
"license": "MIT",
"files": [
"es",
"lib",
"dist",
"volar.d.ts",
"web-types.json",
"README.md"
],
"web-types": "./web-types.json",
"lint-staged": {
"*.js": [
"prettier --write",
"eslint --fix"
],
"*.ts": [
"prettier --write",
"eslint --fix"
],
"*.tsx": [
"prettier --write",
"eslint --fix"
],
"*.vue": [
"prettier --parser=vue --write",
"eslint --fix"
],
"*.css": [
"prettier --write"
],
"*.md": [
"prettier --write --parser markdown --prose-wrap never",
"eslint --fix"
]
"peerDependencies": {
"vue": "^3.0.0"
},
"dependencies": {
"@css-render/plugin-bem": "^0.15.12",
"@css-render/vue3-ssr": "^0.15.12",
"@types/katex": "^0.16.2",
"@types/lodash": "^4.14.198",
"@types/lodash-es": "^4.17.9",
"async-validator": "^4.2.5",
"css-render": "^0.15.12",
"csstype": "^3.1.3",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"evtd": "^0.2.4",
"highlight.js": "^11.8.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"seemly": "^0.3.8",
"treemate": "^0.3.11",
"vdirs": "^0.1.8",
"vooks": "^0.2.12",
"vueuc": "^0.4.58"
},
"devDependencies": {
"@antfu/eslint-config": "^2.22.0",
"@babel/core": "^7.22.15",
"@babel/eslint-parser": "^7.22.15",
"@babel/generator": "^7.22.15",
"@babel/parser": "^7.22.16",
"@babel/preset-env": "^7.22.15",
@ -88,15 +100,11 @@
"@rollup/plugin-terser": "^0.4.3",
"@types/estree": "^1.0.1",
"@types/jest": "^29.5.4",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@vicons/fluent": "^0.12.0",
"@vicons/ionicons4": "^0.12.0",
"@vicons/ionicons5": "^0.12.0",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/compiler-sfc": "^3.4.15",
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/server-renderer": "~3.4.15",
"@vue/test-utils": "^2.4.1",
"autoprefixer": "^10.4.15",
@ -105,16 +113,7 @@
"cssnano": "^7.0.4",
"deepmerge": "^4.3.1",
"esbuild": "0.21.5",
"eslint": "^8.57.0",
"eslint-config-love": "^47.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-markdown": "^4.0.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.17.0",
"eslint": "^9.6.0",
"express": "^4.18.2",
"fast-glob": "^3.3.1",
"fs-extra": "^11.1.1",
@ -140,43 +139,6 @@
"vue-router": "^4.2.4",
"vue-tsc": "^2.0.6"
},
"peerDependencies": {
"vue": "^3.0.0"
},
"dependencies": {
"@css-render/plugin-bem": "^0.15.12",
"@css-render/vue3-ssr": "^0.15.12",
"@types/katex": "^0.16.2",
"@types/lodash": "^4.14.198",
"@types/lodash-es": "^4.17.9",
"async-validator": "^4.2.5",
"css-render": "^0.15.12",
"csstype": "^3.1.3",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"evtd": "^0.2.4",
"highlight.js": "^11.8.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"seemly": "^0.3.8",
"treemate": "^0.3.11",
"vdirs": "^0.1.8",
"vooks": "^0.2.12",
"vueuc": "^0.4.58"
},
"sideEffects": false,
"homepage": "https://www.naiveui.com",
"repository": {
"type": "git",
"url": "https://github.com/tusen-ai/naive-ui"
},
"keywords": [
"naive-ui",
"component library",
"ui framework",
"ui",
"vue"
],
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
@ -186,5 +148,30 @@
"webpack"
]
}
},
"lint-staged": {
"*.js": [
"prettier --write",
"eslint --fix"
],
"*.ts": [
"prettier --write",
"eslint --fix"
],
"*.tsx": [
"prettier --write",
"eslint --fix"
],
"*.vue": [
"prettier --parser=vue --write",
"eslint --fix"
],
"*.css": [
"prettier --write"
],
"*.md": [
"prettier --write --parser markdown --prose-wrap never",
"eslint --fix"
]
}
}

View File

@ -1,23 +1,23 @@
{
"compilerOptions": {
"paths": {
"naive-ui": ["./src"]
},
"strict": true,
"strictNullChecks": true,
"composite": true,
"target": "ES6",
"jsx": "preserve",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"noImplicitAny": true,
"noUnusedLocals": true,
"lib": ["ESNext", "DOM"],
"module": "ES6",
"moduleResolution": "Node",
"paths": {
"naive-ui": ["./src"]
},
"types": ["vue/jsx", "jest"],
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"composite": true,
"target": "ES6",
"types": ["vue/jsx","jest"],
"esModuleInterop": true,
"lib": ["ESNext", "DOM"]
"forceConsistentCasingInFileNames": true
}
}