File tree Expand file tree Collapse file tree 2 files changed +35
-6
lines changed
packages/@vue/cli-plugin-eslint Expand file tree Collapse file tree 2 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -120,3 +120,22 @@ test('should not fix with --no-fix option', async () => {
120120 // files should not have been fixed
121121 expect ( await read ( 'src/main.js' ) ) . not . toMatch ( ';' )
122122} )
123+
124+ // #3167
125+ test ( 'should not throw when src folder is ignored by .eslintignore' , async ( ) => {
126+ const project = await create ( 'eslint-ignore' , {
127+ plugins : {
128+ '@vue/cli-plugin-babel' : { } ,
129+ '@vue/cli-plugin-eslint' : {
130+ config : 'airbnb' ,
131+ lintOn : 'commit'
132+ }
133+ }
134+ } )
135+
136+ const { write, run } = project
137+ await write ( '.eslintignore' , 'src\n' )
138+
139+ // should not throw
140+ await run ( 'vue-cli-service lint' )
141+ } )
Original file line number Diff line number Diff line change @@ -31,17 +31,27 @@ module.exports = function lint (args = {}, api) {
3131 cwd
3232 } , argsConfig )
3333
34+ const engine = new CLIEngine ( config )
35+
36+ // .eslintrc.js files (ignored by default)
37+ const dotFiles = [
38+ '.*.js' ,
39+ '{src,tests}/**/.*.js'
40+ ] . filter ( pattern => globby . sync ( path . join ( cwd , pattern ) ) . length )
41+
3442 const defaultFilesToLint = [
3543 'src' ,
3644 'tests' ,
3745 // root config files
38- '*.js' ,
39- // .eslintrc files (ignored by default)
40- '.*.js' ,
41- '{src,tests}/**/.*.js'
42- ] . filter ( pattern => globby . sync ( path . join ( cwd , pattern ) ) . length )
46+ '*.js'
47+ ]
48+ . filter ( pattern =>
49+ globby
50+ . sync ( path . join ( cwd , pattern ) )
51+ . some ( p => ! engine . isPathIgnored ( p ) )
52+ )
53+ . concat ( dotFiles )
4354
44- const engine = new CLIEngine ( config )
4555 const files = args . _ && args . _ . length
4656 ? args . _
4757 : defaultFilesToLint
You can’t perform that action at this time.
0 commit comments