@lntvow/eslint-config 9.1.2 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/{src/typegen.d.ts → dist/index.d.cts} +186 -28
- package/dist/index.d.ts +15281 -0
- package/dist/index.js +1 -0
- package/package.json +5 -2
- package/.czrc +0 -3
- package/.editorconfig +0 -14
- package/.env.development +0 -1
- package/.env.production +0 -1
- package/.env.uat +0 -1
- package/.github/workflows/publish-npm.yml +0 -44
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.lintstagedrc +0 -4
- package/.prettierrc +0 -10
- package/.vscode/settings.json +0 -14
- package/api/basic.js +0 -22
- package/api/vue.js +0 -34
- package/commitlint.config.cjs +0 -4
- package/eslint.config.js +0 -21
- package/packages/eslint-config-ts/index.js +0 -85
- package/packages/eslint-config-ts/package.json +0 -18
- package/packages/eslint-plugin/index.js +0 -5
- package/packages/eslint-plugin/package.json +0 -16
- package/packages/eslint-plugin/rules/get.js +0 -18
- package/packages/eslint-plugin/test/get.test.js +0 -39
- package/src/configs/gitignore.ts +0 -34
- package/src/configs/ignores.ts +0 -10
- package/src/configs/imports.ts +0 -17
- package/src/configs/index.ts +0 -8
- package/src/configs/javascript.ts +0 -161
- package/src/configs/prettier.ts +0 -18
- package/src/configs/stylistic.ts +0 -59
- package/src/configs/typescript.ts +0 -63
- package/src/configs/vue.ts +0 -316
- package/src/factory.ts +0 -167
- package/src/globs.ts +0 -86
- package/src/index.ts +0 -7
- package/src/types.ts +0 -127
- package/src/typings/index.d.ts +0 -3
- package/src/utils/index.ts +0 -30
- package/test/js.vue +0 -28
- package/test/jsx.vue +0 -27
- package/test/test.js +0 -11
- package/test/test.ts +0 -18
- package/test/ts.vue +0 -26
- package/test/tsx.vue +0 -23
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -10
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FlatConfigComposer as re}from"eslint-flat-config-utils";import{isBoolean as te}from"@lntvow/utils";import{isPackageExists as P}from"local-pkg";import q from"fs";import{findUpSync as N}from"find-up";import{castArray as R}from"@lntvow/utils";import A from"parse-gitignore";async function _(e){let{name:o=".gitignore",root:r=!1,files:p=r?o:N(o)||[]}=e,t=R(p),n=[];for(let u of t)try{let f=q.readFileSync(u,"utf8"),v=A(f).globs();for(let c of v)c.type==="ignore"?n.push(...c.patterns):c.type==="unignore"&&n.push(...c.patterns.map(l=>`!${l}`))}catch{throw new Error(`Failed to read file: ${u}`)}return[{ignores:n}]}var m="?([cm])[jt]s?(x)",d="**/*.?([cm])[jt]s?(x)",ue="**/*.?([cm])js",le="**/*.?([cm])jsx",me="**/*.?([cm])ts",ve="**/*.?([cm])tsx",V="**/*.{c,le,sc}ss",de="**/*.css",ye="**/*.{p,post}css",ge="**/*.less",xe="**/*.scss",D="**/*.json",U="**/*.json5",Oe="**/*.jsonc",C="**/*.md",be="**/*.md/*.md",$="**/*.svelte",x="**/*.vue",M="**/*.y?(a)ml",he="**/*.toml",K="**/*.xml",X="**/*.htm?(l)",we="**/*.astro",_e="**/*.{g,graph}ql",Ce=`${C}/${d}`,Le=[`**/__tests__/**/*.${m}`,`**/*.spec.${m}`,`**/*.test.${m}`,`**/*.bench.${m}`,`**/*.benchmark.${m}`],Te=[d,V,D,U,C,$,x,M,K,X],L=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function T(){return[{ignores:[...L]}]}import J from"eslint-plugin-import-x";async function S(){return[{name:"lntvow/imports/rules",plugins:{import:J},rules:{"import/order":"error","import/newline-after-import":"error"}}]}import W from"@eslint/js";import O from"globals";async function j(e={}){let{overrides:o={}}=e;return[{name:"lntvow/javascript/rules",languageOptions:{ecmaVersion:2022,sourceType:"module",parserOptions:{ecmaVersion:2022,sourceType:"module",ecmaFeatures:{jsx:!0}},globals:{...O.browser,...O.es2021,...O.node,document:"readonly",navigator:"readonly",window:"readonly"}},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...W.configs.all.rules,"no-unused-vars":"warn","no-use-before-define":["error",{functions:!1}],camelcase:"warn","capitalized-comments":"off","class-methods-use-this":"off",complexity:"off",curly:["error","multi-line"],"func-names":"off","func-style":"off","guard-for-in":"off","id-denylist":"off","id-length":"off","id-match":"off","init-declarations":"off","max-classes-per-file":"off","max-depth":"off","max-lines":"off","max-lines-per-function":"off","max-nested-callbacks":"off","max-params":"off","max-statements":"off","new-cap":["error",{capIsNew:!1}],"no-bitwise":"off","no-case-declarations":"off","no-console":"warn","no-continue":"off","no-empty":["error",{allowEmptyCatch:!0}],"no-implicit-coercion":"off","no-implicit-globals":"off","no-magic-numbers":["warn",{ignoreArrayIndexes:!0,ignoreDefaultValues:!0}],"no-nested-ternary":"off","no-new":"off","no-param-reassign":"off","no-plusplus":"off","no-restricted-exports":"off","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-imports":"off","no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":"off","no-shadow":"off","no-ternary":"off","no-throw-literal":"off","no-underscore-dangle":"off","no-void":"off","no-warning-comments":"off","one-var":"off","prefer-exponentiation-operator":"off","prefer-promise-reject-errors":"off",radix:"off","require-await":"off","require-unicode-regexp":"off","sort-imports":"off","sort-keys":"off","sort-vars":"off",strict:"off",...o}}]}import H from"eslint-plugin-prettier";import z from"eslint-config-prettier";async function G(){return[{name:"lntvow/prettier/rules",plugins:{prettier:H},rules:{...z.rules,"prettier/prettier":"warn"}}]}import F from"@stylistic/eslint-plugin";var Y={indent:2,jsx:!0,quotes:"single",semi:!1};async function B(e={}){let{indent:o,jsx:r,overrides:p={},quotes:t,semi:n}={...Y,...e},u=F.configs.customize({flat:!0,indent:o,jsx:r,pluginName:"style",quotes:t,semi:n});return[{name:"lntvow/stylistic/rules",plugins:{style:F},rules:{"style/spaced-comment":"error","style/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"function"}],...p}}]}import h from"@typescript-eslint/eslint-plugin";import Q from"@typescript-eslint/parser";function b(e,o){return Object.fromEntries(Object.entries(e).map(([r,p])=>{for(let[t,n]of Object.entries(o))if(r.startsWith(`${t}/`))return[n+r.slice(t.length),p];return[r,p]}))}async function k(e={}){let{componentExts:o=[],overrides:r={},parserOptions:p={}}=e,t=[d,...o.map(n=>`**/*.${n}`)];return[{name:"lntvow/typescript/rules",plugins:{typescript:h},languageOptions:{parser:Q,parserOptions:{sourceType:"module"}},files:t,rules:{...b(h.configs["eslint-recommended"].overrides[0].rules,{"@typescript-eslint":"typescript"}),...b(h.configs.strict.rules,{"@typescript-eslint":"typescript"}),"typescript/no-non-null-assertion":"off","typescript/no-explicit-any":"off","typescript/ban-ts-comment":"off","typescript/no-unused-vars":"warn","no-use-before-define":"off","typescript/no-use-before-define":["error",{functions:!1}],...r}}]}import{getPackageInfoSync as Z}from"local-pkg";import I from"@typescript-eslint/parser";import ee from"vue-eslint-parser";import a from"eslint-plugin-vue";async function E(e={}){let{overrides:o={},vueVersion:r=oe()}=e,p={...a.configs["vue3-essential"].rules,...a.configs["vue3-strongly-recommended"].rules,...a.configs["vue3-recommended"].rules,"vue/block-lang":["error",{script:{lang:["ts","tsx"]}}],"vue/block-order":["error",{order:["script[setup]","template","style[scoped]"]}],"vue/component-api-style":"error"},t={...a.configs.essential.rules,...a.configs["strongly-recommended"].rules,...a.configs.recommended.rules,"vue/block-lang":["error",{script:{allowNoLang:!0}}],"vue/block-order":["error",{order:[["script","template"],"style[scoped]"]}]};return[{name:"lntvow/vue/rules",plugins:{vue:a},languageOptions:{parser:ee,parserOptions:{ecmaFeatures:{jsx:!0},parser:{ts:I,tsx:I},sourceType:"module"}},processor:a.processors[".vue"],files:[x],rules:{...a.configs.base.rules,...r===3?p:t,"vue/multi-word-component-names":"off","vue/attribute-hyphenation":["error","never"],"vue/html-indent":"off","vue/html-self-closing":["error",{html:{void:"always",normal:"always",component:"always"},svg:"always",math:"always"}],"vue/max-attributes-per-line":"off","vue/singleline-html-element-content-newline":"off","vue/v-on-event-hyphenation":["error","never"],"vue/block-tag-newline":"error","vue/component-name-in-template-casing":["error","PascalCase",{ignores:["/-/"]}],"vue/component-options-name-casing":"error","vue/custom-event-name-casing":"error","vue/define-emits-declaration":"error","vue/define-macros-order":"error","vue/define-props-declaration":"error","vue/enforce-style-attribute":"error","vue/html-button-has-type":"off","vue/html-comment-content-newline":"error","vue/html-comment-content-spacing":"error","vue/html-comment-indent":"off","vue/match-component-file-name":["error",{extensions:["jsx","tsx"],shouldMatchCase:!0}],"vue/match-component-import-name":"error","vue/max-lines-per-block":"off","vue/new-line-between-multi-line-property":"off","vue/next-tick-style":"off","vue/no-bare-strings-in-template":"off","vue/no-boolean-default":"off","vue/no-deprecated-model-definition":"error","vue/no-duplicate-attr-inheritance":"error","vue/no-empty-component-block":"off","vue/no-multiple-objects-in-class":"error","vue/no-potential-component-option-typo":"error","vue/no-ref-object-reactivity-loss":"error","vue/no-required-prop-with-default":"error","vue/no-restricted-block":"off","vue/no-restricted-call-after-await":"off","vue/no-restricted-class":"off","vue/no-restricted-component-names":"off","vue/no-restricted-component-options":"off","vue/no-restricted-custom-event":"off","vue/no-restricted-html-elements":"off","vue/no-restricted-props":"off","vue/no-restricted-static-attribute":"off","vue/no-restricted-v-bind":"off","vue/no-root-v-if":"off","vue/no-setup-props-reactivity-loss":"error","vue/no-static-inline-styles":"error","vue/no-template-target-blank":"error","vue/no-this-in-before-route-enter":"error","vue/no-undef-components":"off","vue/no-undef-properties":"error","vue/no-unsupported-features":"off","vue/no-unused-emit-declarations":"error","vue/no-unused-properties":["warn",{groups:["props","data","computed","methods","setup"]}],"vue/no-unused-refs":"error","vue/no-use-v-else-with-v-for":"error","vue/no-useless-mustaches":"error","vue/no-useless-v-bind":"error","vue/no-v-text":"error","vue/padding-line-between-blocks":"error","vue/padding-line-between-tags":["error",[{blankLine:"never",prev:"*",next:"*"}]],"vue/padding-lines-in-component-definition":["error",{betweenOptions:"never"}],"vue/prefer-define-options":"error","vue/prefer-prop-type-boolean-first":"error","vue/prefer-separate-static-class":"error","vue/prefer-true-attribute-shorthand":"error","vue/require-direct-export":"error","vue/require-emit-validator":"off","vue/require-explicit-slots":"error","vue/require-expose":"error","vue/require-macro-variable-name":"error","vue/require-name-property":"off","vue/require-prop-comment":"off","vue/require-typed-object-prop":"error","vue/require-typed-ref":"error","vue/script-indent":"off","vue/sort-keys":"off","vue/static-class-names-order":"error","vue/v-for-delimiter-style":"error","vue/v-on-handler-style":"error","vue/valid-define-options":"error","vue/array-bracket-newline":"off","vue/array-bracket-spacing":"off","vue/array-element-newline":"off","vue/arrow-spacing":"off","vue/block-spacing":"off","vue/brace-style":"off","vue/camelcase":"error","vue/comma-dangle":"off","vue/comma-spacing":"off","vue/comma-style":"off","vue/dot-location":"off","vue/dot-notation":"error","vue/eqeqeq":"error","vue/func-call-spacing":"off","vue/key-spacing":"off","vue/keyword-spacing":"off","vue/max-len":"off","vue/multiline-ternary":"off","vue/no-console":"off","vue/no-constant-condition":"error","vue/no-extra-parens":"off","vue/no-empty-pattern":"error","vue/no-irregular-whitespace":"error","vue/no-loss-of-precision":"off","vue/no-restricted-syntax":"off","vue/no-sparse-arrays":"error","vue/no-useless-concat":"error","vue/object-curly-newline":"off","vue/object-curly-spacing":"off","vue/object-property-newline":"off","vue/object-shorthand":"error","vue/operator-linebreak":"off","vue/prefer-template":"error","vue/quote-props":"off","vue/space-in-parens":"off","vue/space-infix-ops":"off","vue/space-unary-ops":"off","vue/template-curly-spacing":"off",...o}}]}function oe(){let e=Z("vue",{paths:[process.cwd()]});return e&&e.version?+e.version[0]:3}var ne=["name","files","ignores","languageOptions","linterOptions","processor","plugins","rules","settings"];function w(e={},...o){let{componentExts:r=[],gitignore:p=!0,typescript:t=P("typescript"),vue:n=["vue","nuxt","vitepress"].some(l=>P(l))}=e,u=e.stylistic===!1?!1:typeof e.stylistic=="object"?e.stylistic:{},f=[];f.push(T(),j({...y(e,"javascript")}),S()),p&&f.push(_(y(e,"gitignore"))),n&&r.push("vue"),t&&f.push(k({...y(e,"typescript"),componentExts:r})),u&&f.push(B({...u})),n&&f.push(E({...y(e,"vue")})),f.push(G());let v=ne.reduce((l,g)=>(g in e&&(l[g]=e[g]),l),{});Object.keys(v).length&&f.push([v]);let c=new re;return c=c.append(...f,...o),c}function y(e,o){return te(e[o])?{}:e[o]||{}}var jo=w;export{Te as GLOB_ALL_SRC,we as GLOB_ASTRO,de as GLOB_CSS,L as GLOB_EXCLUDE,_e as GLOB_GRAPHQL,X as GLOB_HTML,ue as GLOB_JS,D as GLOB_JSON,U as GLOB_JSON5,Oe as GLOB_JSONC,le as GLOB_JSX,ge as GLOB_LESS,C as GLOB_MARKDOWN,Ce as GLOB_MARKDOWN_CODE,be as GLOB_MARKDOWN_IN_MARKDOWN,ye as GLOB_POSTCSS,xe as GLOB_SCSS,d as GLOB_SRC,m as GLOB_SRC_EXT,V as GLOB_STYLE,$ as GLOB_SVELTE,Le as GLOB_TESTS,he as GLOB_TOML,me as GLOB_TS,ve as GLOB_TSX,x as GLOB_VUE,K as GLOB_XML,M as GLOB_YAML,Y as StylisticConfigDefaults,jo as default,oe as getVueVersion,_ as gitignore,T as ignores,S as imports,j as javascript,w as lntvow,G as prettier,b as renameRules,B as stylistic,k as typescript,E as vue};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/eslint-config",
|
|
3
|
-
"version": "9.1
|
|
3
|
+
"version": "9.2.1",
|
|
4
4
|
"author": "lntvow",
|
|
5
5
|
"description": "eslint-config",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"node": ">=18.12.0",
|
|
10
10
|
"pnpm": ">=9.0.0"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
12
15
|
"main": "./dist/index.js",
|
|
13
16
|
"module": "./dist/index.js",
|
|
14
17
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
"vue-eslint-parser": "^9.4.2"
|
|
46
49
|
},
|
|
47
50
|
"scripts": {
|
|
48
|
-
"dev": "pnpm build --watch",
|
|
51
|
+
"dev": "pnpm build --format esm --watch",
|
|
49
52
|
"build": "tsup",
|
|
50
53
|
"commit": "git add . && git-cz",
|
|
51
54
|
"rimraf": "rimraf ./node_modules/",
|
package/.czrc
DELETED
package/.editorconfig
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
end_of_line = lf
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
trim_trailing_whitespace = true
|
|
11
|
-
|
|
12
|
-
[*.md]
|
|
13
|
-
insert_final_newline = false
|
|
14
|
-
trim_trailing_whitespace = false
|
package/.env.development
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
package/.env.production
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
package/.env.uat
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: publish-npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
paths:
|
|
7
|
-
# - 'package.json'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish-npm:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
timeout-minutes: 10
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout
|
|
15
|
-
uses: actions/checkout@v3
|
|
16
|
-
|
|
17
|
-
- name: Set Node
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: 20
|
|
21
|
-
registry-url: https://registry.npmjs.org
|
|
22
|
-
|
|
23
|
-
- name: Set pnpm
|
|
24
|
-
uses: pnpm/action-setup@v2
|
|
25
|
-
with:
|
|
26
|
-
version: 9
|
|
27
|
-
|
|
28
|
-
- name: Get pnpm store directory
|
|
29
|
-
shell: bash
|
|
30
|
-
run: |
|
|
31
|
-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
32
|
-
|
|
33
|
-
- uses: actions/cache@v3
|
|
34
|
-
name: Setup pnpm cache
|
|
35
|
-
with:
|
|
36
|
-
path: ${{ env.STORE_PATH }}
|
|
37
|
-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
38
|
-
restore-keys: |
|
|
39
|
-
${{ runner.os }}-pnpm-store-
|
|
40
|
-
|
|
41
|
-
- run: pnpm install
|
|
42
|
-
- run: pnpm publish --access public
|
|
43
|
-
env:
|
|
44
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH}}
|
package/.husky/commit-msg
DELETED
package/.husky/pre-commit
DELETED
package/.lintstagedrc
DELETED
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
package/api/basic.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as cheerio from 'cheerio'
|
|
2
|
-
import axios from 'axios'
|
|
3
|
-
import { javascript } from '../dist/index.js'
|
|
4
|
-
|
|
5
|
-
// Const basicKeys = Object.keys(basicRules);
|
|
6
|
-
const rulesMap = {}
|
|
7
|
-
|
|
8
|
-
axios.get('https://eslint.org/docs/latest/rules/').then(async res => {
|
|
9
|
-
const $ = cheerio.load(res.data),
|
|
10
|
-
filteredElements = $('.rule').filter((i, e) => !($(e).is('.rule--deprecated') || $(e).is('.rule--removed')))
|
|
11
|
-
|
|
12
|
-
filteredElements.each((i, el) => {
|
|
13
|
-
const ruleName = $(el).find('.rule__name').text()
|
|
14
|
-
rulesMap[ruleName] = 2
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const keyList = Object.keys(rulesMap)
|
|
18
|
-
const rulesList = Object.keys((await javascript())[0].rules)
|
|
19
|
-
|
|
20
|
-
const diff = keyList.filter(key => !rulesList.includes(key))
|
|
21
|
-
console.log('diff: ', diff)
|
|
22
|
-
})
|
package/api/vue.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-top-level-await */
|
|
2
|
-
const axios = require('axios')
|
|
3
|
-
const cheerio = require('cheerio')
|
|
4
|
-
const { rules } = require('../packages/eslint-config-vue')
|
|
5
|
-
|
|
6
|
-
const keys = Object.keys(rules)
|
|
7
|
-
const eslintKeys = []
|
|
8
|
-
|
|
9
|
-
axios.get('https://eslint.vuejs.org/rules/').then(res => {
|
|
10
|
-
const $ = cheerio.load(res.data)
|
|
11
|
-
|
|
12
|
-
const filteredElements = $('.group').filter((i, e) => {
|
|
13
|
-
return ['Extension Rules', 'Uncategorized'].includes($(e).find('.item[tabindex="0"] .text').text())
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
filteredElements.each((i, el) => {
|
|
17
|
-
const list = $(el).find('.items .is-link')
|
|
18
|
-
list.each((i, e) => {
|
|
19
|
-
const ruleName = $(e).find('.item .text').text()
|
|
20
|
-
eslintKeys.push(ruleName)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const diff = eslintKeys.filter(key => !keys.includes(key))
|
|
25
|
-
console.log('eslintKeys: ', eslintKeys)
|
|
26
|
-
console.log('diff: ', diff)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 使用 isEmail
|
|
31
|
-
*/
|
|
32
|
-
export function validatorEmail(value) {
|
|
33
|
-
return /^([\w-])+@([\w-])+(\.[\w-])+/.test(value)
|
|
34
|
-
}
|
package/commitlint.config.cjs
DELETED
package/eslint.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import pluginStylistic from '@stylistic/eslint-plugin'
|
|
2
|
-
import { lntvow, GLOB_SRC, renameRules } from './dist/index.js'
|
|
3
|
-
|
|
4
|
-
const config = await lntvow({
|
|
5
|
-
vue: true,
|
|
6
|
-
typescript: true,
|
|
7
|
-
gitignore: {
|
|
8
|
-
},
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const files = [GLOB_SRC]
|
|
12
|
-
|
|
13
|
-
// 1
|
|
14
|
-
export default [
|
|
15
|
-
...config,
|
|
16
|
-
{
|
|
17
|
-
// rules: {
|
|
18
|
-
// 'style/quotes': 'error',
|
|
19
|
-
// },
|
|
20
|
-
},
|
|
21
|
-
]
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'@lntvow/eslint-config-basic',
|
|
4
|
-
'plugin:import/typescript',
|
|
5
|
-
'plugin:@typescript-eslint/strict',
|
|
6
|
-
'plugin:@typescript-eslint/stylistic',
|
|
7
|
-
],
|
|
8
|
-
settings: {
|
|
9
|
-
'import/resolver': { typescript: true },
|
|
10
|
-
},
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: ['*.js', '*.cjs'],
|
|
14
|
-
// 禁用js文件的类型检查
|
|
15
|
-
extends: ['plugin:@typescript-eslint/disable-type-checked'],
|
|
16
|
-
rules: {
|
|
17
|
-
'@typescript-eslint/no-var-requires': 0, // 允许使用require
|
|
18
|
-
'@typescript-eslint/consistent-type-assertions': 0, // 禁用js文件的类型检查
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
files: ['*.ts', '*.tsx', '*.d.ts'],
|
|
23
|
-
// 禁用js文件的类型检查
|
|
24
|
-
rules: {
|
|
25
|
-
'spaced-comment': 0, // 警用注释检查
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
files: ['*.ts', '*.tsx', '*.vue'],
|
|
30
|
-
rules: {
|
|
31
|
-
/**
|
|
32
|
-
* 重写import规则
|
|
33
|
-
*/
|
|
34
|
-
'import/namespace': 0, // 导入校验
|
|
35
|
-
'import/no-cycle': 0, // 循环导入
|
|
36
|
-
'import/no-unused-modules': 0, // 导入未使用的模块
|
|
37
|
-
'import/no-named-as-default': 0, // 校验导出名称
|
|
38
|
-
'import/no-unresolved': 0, // 导入目录校验
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 重写ts规则
|
|
42
|
-
*/
|
|
43
|
-
'@typescript-eslint/no-non-null-assertion': 0, // 允许使用!断言
|
|
44
|
-
'@typescript-eslint/ban-types': 0, // 允许使用object
|
|
45
|
-
'@typescript-eslint/no-explicit-any': 0, // 允许使用any
|
|
46
|
-
'@typescript-eslint/ban-ts-comment': 0, // 允许使用ts注释
|
|
47
|
-
|
|
48
|
-
'@typescript-eslint/no-unused-vars': 1, // 未使用的变量 警告
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 重写js规则
|
|
52
|
-
*/
|
|
53
|
-
'no-undef': 0, // ts自带 允许使用未定义的变量
|
|
54
|
-
'no-use-before-define': 0,
|
|
55
|
-
'@typescript-eslint/no-use-before-define': [
|
|
56
|
-
2,
|
|
57
|
-
{
|
|
58
|
-
functions: false,
|
|
59
|
-
classes: true,
|
|
60
|
-
variables: false,
|
|
61
|
-
allowNamedExports: false,
|
|
62
|
-
enums: true,
|
|
63
|
-
typedefs: true,
|
|
64
|
-
ignoreTypeReferences: true,
|
|
65
|
-
},
|
|
66
|
-
], // 变量定义前禁止使用
|
|
67
|
-
'lines-around-comment': 'off',
|
|
68
|
-
'@typescript-eslint/lines-around-comment': [
|
|
69
|
-
2,
|
|
70
|
-
{
|
|
71
|
-
allowBlockStart: true,
|
|
72
|
-
allowObjectStart: true,
|
|
73
|
-
allowArrayStart: true,
|
|
74
|
-
allowClassStart: true,
|
|
75
|
-
allowEnumStart: true,
|
|
76
|
-
allowInterfaceStart: true,
|
|
77
|
-
allowModuleStart: true,
|
|
78
|
-
allowTypeStart: true,
|
|
79
|
-
},
|
|
80
|
-
], // 注释空行,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
rules: {},
|
|
85
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lntvow/eslint-config-ts",
|
|
3
|
-
"version": "8.5.0",
|
|
4
|
-
"description": "eslint/ts配置文件",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"author": "lntvow",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"files": [
|
|
10
|
-
"index.js"
|
|
11
|
-
],
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@lntvow/eslint-config-basic": "workspace:*",
|
|
14
|
-
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
15
|
-
"@typescript-eslint/parser": "^6.2.0",
|
|
16
|
-
"eslint-import-resolver-typescript": "^3.5.5"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lntvow/eslint-plugin",
|
|
3
|
-
"version": "8.5.0",
|
|
4
|
-
"description": "eslint/plugin文件",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"author": "lntvow",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"files": [
|
|
10
|
-
"index.js"
|
|
11
|
-
],
|
|
12
|
-
"dependencies": {},
|
|
13
|
-
"peerDependencies": {
|
|
14
|
-
"eslint": ">=8.43.0"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
create(content) {
|
|
3
|
-
const options = content.options[1]
|
|
4
|
-
return {
|
|
5
|
-
ExpressionStatement(node) {
|
|
6
|
-
const callee = node.expression.callee
|
|
7
|
-
console.log('callee: ', callee)
|
|
8
|
-
const name = callee.property.name
|
|
9
|
-
if (options[name] === 2) {
|
|
10
|
-
content.report({
|
|
11
|
-
node,
|
|
12
|
-
message: `不能使用console.${name}`,
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const rule = require('../rules/get')
|
|
2
|
-
const RuleTester = require('eslint').RuleTester
|
|
3
|
-
|
|
4
|
-
const ruleTester = new RuleTester()
|
|
5
|
-
|
|
6
|
-
ruleTester.run('get', rule, {
|
|
7
|
-
valid: [
|
|
8
|
-
{
|
|
9
|
-
name: 'success',
|
|
10
|
-
code: 'var a = 10',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
invalid: [
|
|
14
|
-
{
|
|
15
|
-
name: 'hash log',
|
|
16
|
-
code: "console.log('context: ', context.options)",
|
|
17
|
-
options: [
|
|
18
|
-
2,
|
|
19
|
-
{
|
|
20
|
-
log: 2,
|
|
21
|
-
warn: 2,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
errors: [{ message: '不能使用console.log' }],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'hash warn',
|
|
28
|
-
code: "console.warn('context: ', context.options)",
|
|
29
|
-
options: [
|
|
30
|
-
2,
|
|
31
|
-
{
|
|
32
|
-
log: 2,
|
|
33
|
-
warn: 2,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
errors: [{ message: '不能使用console.warn' }],
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
})
|
package/src/configs/gitignore.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { findUpSync } from 'find-up'
|
|
3
|
-
import { castArray } from '@lntvow/utils'
|
|
4
|
-
import parse from 'parse-gitignore'
|
|
5
|
-
import type { FlatGitignoreOptions, TypedFlatConfigItem } from '../types'
|
|
6
|
-
|
|
7
|
-
export async function gitignore(options: FlatGitignoreOptions): Promise<TypedFlatConfigItem[]> {
|
|
8
|
-
const { name = '.gitignore', root = false, files: _files = root ? name : findUpSync(name) || [] } = options
|
|
9
|
-
const files = castArray(_files)
|
|
10
|
-
|
|
11
|
-
const ignores = []
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
try {
|
|
14
|
-
const content = fs.readFileSync(file, 'utf8')
|
|
15
|
-
|
|
16
|
-
const globs = parse(content).globs()
|
|
17
|
-
for (const glob of globs) {
|
|
18
|
-
if (glob.type === 'ignore') {
|
|
19
|
-
ignores.push(...glob.patterns)
|
|
20
|
-
} else if (glob.type === 'unignore') {
|
|
21
|
-
ignores.push(...glob.patterns.map((pattern: string) => `!${pattern}`))
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} catch (error) {
|
|
25
|
-
throw new Error(`Failed to read file: ${file}`)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
ignores,
|
|
32
|
-
},
|
|
33
|
-
]
|
|
34
|
-
}
|
package/src/configs/ignores.ts
DELETED
package/src/configs/imports.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import pluginImport from 'eslint-plugin-import-x'
|
|
2
|
-
import type { TypedFlatConfigItem } from '../types'
|
|
3
|
-
|
|
4
|
-
export async function imports(): Promise<TypedFlatConfigItem[]> {
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
name: 'lntvow/imports/rules',
|
|
8
|
-
plugins: {
|
|
9
|
-
import: pluginImport,
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
'import/order': 'error',
|
|
13
|
-
'import/newline-after-import': 'error',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
]
|
|
17
|
-
}
|