diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..54f0bce7b74 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +**/vs/nls.build.js +**/vs/nls.js +**/vs/css.build.js +**/vs/css.js +**/vs/loader.js +**/promise-polyfill/** +**/insane/** +**/marked/** +**/test/**/*.js +**/node_modules/** +**/vscode-api-tests/testWorkspace/** +**/extensions/**/out/** +**/extensions/**/build/** diff --git a/.eslintrc.json b/.eslintrc.json index 29efa7cbbc2..66628b052d9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,20 +1,54 @@ { - "root": true, - "env": { - "node": true, - "es6": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": 1, - "no-extra-semi": "warn", - "semi": "warn" - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - } + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "code-oss-eslint", + "@typescript-eslint" + ], + "rules": { + "no-extra-semi": "off", + "no-unused-vars": "off", + "eqeqeq": "warn", + "semi": "off", + "@typescript-eslint/semi": "warn", + "no-duplicate-imports": "warn", + "code-oss-eslint/layering": [ + "warn", + { + "common": [], + "node": [ + "common" + ], + "browser": [ + "common" + ], + "electron-main": [ + "common", + "node" + ], + "electron-browser": [ + "common", + "browser", + "node" + ] + } + ], + "@typescript-eslint/class-name-casing": "warn", + "constructor-super": "warn", + "curly": "warn", + "no-caller": "warn", + "no-debugger": "warn", + "no-duplicate-case": "warn", + "no-eval": "warn", + "no-new-wrappers": "warn", + "no-sparse-arrays": "warn", + "no-throw-literal": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-var": "warn" + } } diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index afde823d0b6..3185e325d5c 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -186,7 +186,7 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(gulpeslint('.eslintrc.json')) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); }); @@ -227,7 +227,7 @@ function checkPackageJSON(actualPath) { const checkPackageJSONTask = task.define('check-package-json', () => { return gulp.src('package.json') - .pipe(es.through(function() { + .pipe(es.through(function () { checkPackageJSON.call(this, 'remote/package.json'); checkPackageJSON.call(this, 'remote/web/package.json'); })); @@ -359,7 +359,7 @@ function hygiene(some) { const javascript = result .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(gulpeslint('.eslintrc.json')) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); diff --git a/package.json b/package.json index d97cbae1f74..9f91624475f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", "web": "node scripts/code-web.js", - "eslint": "eslint -c ./src/.eslintrc.json ./src/vs --ext .ts --ext .js" + "eslint": "eslint -c .eslintrc.json --ext .ts --ext .js ./src/vs ./extensions" }, "dependencies": { "applicationinsights": "1.0.8", diff --git a/src/.eslintrc b/src/.eslintrc deleted file mode 100644 index c25b0d558c2..00000000000 --- a/src/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6 - }, - "env": { - "node": true, - "es6": true, - "browser": true, - "amd": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": "error", - "no-extra-semi": "error", - "semi": "error", - "no-inner-declarations": 0 - } -} \ No newline at end of file diff --git a/src/.eslintrc.json b/src/.eslintrc.json deleted file mode 100644 index 879564055ed..00000000000 --- a/src/.eslintrc.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/eslintrc", - "root": true, - "ignorePatterns": [ - "**/vs/nls.build.js", - "**/vs/nls.js", - "**/vs/css.build.js", - "**/vs/css.js", - "**/vs/loader.js", - "**/promise-polyfill/**", - "**/insane/**", - "**/marked/**", - "**/test/**/*.js" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "src/tsconfig.json", - "sourceType": "module" - }, - "plugins": [ - "code-oss-eslint", - "@typescript-eslint" - ], - "rules": { - "no-extra-semi": "off", - "no-unused-vars": "off", - "semi": "warn", - "eqeqeq": "warn", - "no-duplicate-imports": "warn", - "code-oss-eslint/layering": [ - "warn", - { - "common": [], - "node": [ - "common" - ], - "browser": [ - "common" - ], - "electron-main": [ - "common", - "node" - ], - "electron-browser": [ - "common", - "browser", - "node" - ] - } - ], - "@typescript-eslint/class-name-casing": "warn", - "@typescript-eslint/no-for-in-array": "warn", - "@typescript-eslint/semi": [ - "warn", - "always" - ], - "constructor-super": "warn", - "curly": "warn", - "no-caller": "warn", - "no-debugger": "warn", - "no-duplicate-case": "warn", - "no-eval": "warn", - "no-new-wrappers": "warn", - "no-sparse-arrays": "warn", - "no-throw-literal": "warn", - "no-unsafe-finally": "warn", - "no-unused-labels": "warn", - "no-var": "warn" - } -}