Skip to content

Commit

Permalink
fix(cli): fix eslint pattern
Browse files Browse the repository at this point in the history
affects: @varlet/cli
  • Loading branch information
haoziqaq committed Jul 18, 2021
1 parent 0f46b0a commit ae93da1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"publishConfig": {
"access": "public"
},
"ignoreChanges": [
"**/*.md"
],
"ignoreChanges": ["**/*.md"],
"version": "1.9.4"
}
21 changes: 14 additions & 7 deletions packages/varlet-cli/src/commands/lint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import execa from 'execa'
import ora, { Ora } from 'ora'
import { ESLINT_EXTENSIONS } from '../shared/constant'
import { CWD, ESLINT_EXTENSIONS } from '../shared/constant'
import { isDir } from '../shared/fsUtils'
import { resolve } from 'path'

export async function lint() {
let spinner: Ora
Expand All @@ -14,13 +16,18 @@ export async function lint() {
spinner.succeed('stylelint success')

spinner = ora('eslint starting...').start()
await execa('eslint', [

const patterns: string[] = [
'./src',
'packages/varlet-cli/src',
'packages/varlet-ui/src',
'packages/varlet-icons/lib',
'packages/varlet-markdown-loader',
'packages/varlet-vscode-extension/src',
'./packages/varlet-cli/src',
'./packages/varlet-ui/src',
'./packages/varlet-icons/lib',
'./packages/varlet-markdown-loader',
'./packages/varlet-vscode-extension/src',
]

await execa('eslint', [
...patterns.filter((pattern) => isDir(resolve(CWD, pattern))),
'--fix',
'--ext',
ESLINT_EXTENSIONS.join(','),
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-cli/src/shared/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const ES_DIR = resolve(CWD, 'es')
export const UMD_DIR = resolve(CWD, 'umd')
export const TYPES_DIR = resolve(CWD, 'types')
export const ROOT_DOCS_DIR = resolve(CWD, 'docs')
export const ESLINT_EXTENSIONS = ['.vue', '.ts', '.js']
export const ESLINT_EXTENSIONS = ['.vue', '.ts', '.js', '.mjs']
export const EXTENSIONS = ['.vue', '.ts', '.js', '.less', '.css']
export const STYLE_DIR_NAME = 'style'
export const EXAMPLE_DIR_NAME = 'example'
Expand Down
3 changes: 1 addition & 2 deletions scripts/bootstrap.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ora from 'ora'
import { buildCli, buildIcons, buildUI } from './build.mjs'

(async () => {
;(async () => {
let spinner = ora('Start build @varlet/cli & @varlet/icons').start()
await Promise.all([buildCli(), buildIcons()])
spinner.succeed('@varlet/cli & @varlet/icons build success')
Expand Down
3 changes: 1 addition & 2 deletions scripts/publish.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ora from 'ora'
import { buildCli, buildIcons, buildUI } from './build.mjs'

(async () => {
;(async () => {
let spinner = ora('Start build @varlet/cli & @varlet/icons').start()
await Promise.all([buildCli(), buildIcons()])
spinner.succeed('@varlet/cli & @varlet/icons build success')
Expand Down

0 comments on commit ae93da1

Please sign in to comment.