mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
unify eslint filters (#142063)
This commit is contained in:
parent
897fc9508a
commit
7455bc43ad
|
@ -4,20 +4,13 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const es = require('event-stream');
|
||||
const { readFileSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
const vfs = require('vinyl-fs');
|
||||
const { eslintFilter } = require('./filters');
|
||||
|
||||
function eslint() {
|
||||
|
||||
const eslintIgnore = readFileSync(join(__dirname, '../.eslintignore'))
|
||||
.toString().split(/\r\n|\n/)
|
||||
.filter(line => !line.startsWith('#'))
|
||||
.map(line => `!${line}`);
|
||||
|
||||
const gulpeslint = require('gulp-eslint');
|
||||
return vfs
|
||||
.src(['**/*.js', '**/*.ts', ...eslintIgnore], { base: '.', follow: true, allowEmpty: true })
|
||||
.src(eslintFilter, { base: '.', follow: true, allowEmpty: true })
|
||||
.pipe(
|
||||
gulpeslint({
|
||||
configFile: '.eslintrc.json',
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
* all ⊃ eol ⊇ indentation ⊃ copyright ⊃ typescript
|
||||
*/
|
||||
|
||||
const { readFileSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
module.exports.all = [
|
||||
'*',
|
||||
'build/**/*',
|
||||
|
@ -156,21 +159,7 @@ module.exports.copyrightFilter = [
|
|||
'!src/vs/editor/test/node/classification/typescript-test.ts',
|
||||
];
|
||||
|
||||
module.exports.jsHygieneFilter = [
|
||||
'src/**/*.js',
|
||||
'build/gulpfile.*.js',
|
||||
'!src/vs/loader.js',
|
||||
'!src/vs/css.js',
|
||||
'!src/vs/nls.js',
|
||||
'!src/vs/css.build.js',
|
||||
'!src/vs/nls.build.js',
|
||||
'!src/**/dompurify.js',
|
||||
'!src/**/marked.js',
|
||||
'!src/**/semver.js',
|
||||
'!**/test/**',
|
||||
];
|
||||
|
||||
module.exports.tsHygieneFilter = [
|
||||
module.exports.tsFormattingFilter = [
|
||||
'src/**/*.ts',
|
||||
'test/**/*.ts',
|
||||
'extensions/**/*.ts',
|
||||
|
@ -186,3 +175,13 @@ module.exports.tsHygieneFilter = [
|
|||
'!extensions/**/*.test.ts',
|
||||
'!extensions/html-language-features/server/lib/jquery.d.ts',
|
||||
];
|
||||
|
||||
module.exports.eslintFilter = [
|
||||
'**/*.js',
|
||||
'**/*.ts',
|
||||
...readFileSync(join(__dirname, '../.eslintignore'))
|
||||
.toString().split(/\r\n|\n/)
|
||||
.filter(line => !line.startsWith('#'))
|
||||
.filter(line => !!line)
|
||||
.map(line => `!${line}`)
|
||||
];
|
||||
|
|
|
@ -10,7 +10,7 @@ const vfs = require('vinyl-fs');
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const pall = require('p-all');
|
||||
const { all, copyrightFilter, unicodeFilter, indentationFilter, jsHygieneFilter, tsHygieneFilter } = require('./filters');
|
||||
const { all, copyrightFilter, unicodeFilter, indentationFilter, tsFormattingFilter, eslintFilter } = require('./filters');
|
||||
|
||||
const copyrightHeaderLines = [
|
||||
'/*---------------------------------------------------------------------------------------------',
|
||||
|
@ -162,13 +162,13 @@ function hygiene(some, linting = true) {
|
|||
.pipe(copyrights);
|
||||
|
||||
const streams = [
|
||||
result.pipe(filter(tsHygieneFilter)).pipe(formatting)
|
||||
result.pipe(filter(tsFormattingFilter)).pipe(formatting)
|
||||
];
|
||||
|
||||
if (linting) {
|
||||
streams.push(
|
||||
result
|
||||
.pipe(filter([...jsHygieneFilter, ...tsHygieneFilter]))
|
||||
.pipe(filter(eslintFilter))
|
||||
.pipe(
|
||||
gulpeslint({
|
||||
configFile: '.eslintrc.json',
|
||||
|
|
Loading…
Reference in a new issue