mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-27 02:21:27 +08:00
using one eslint config
This commit is contained in:
parent
03ff40ca52
commit
63d9287a3a
3 changed files with 45 additions and 40 deletions
|
|
@ -16,13 +16,16 @@
|
|||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:json/recommended",
|
||||
"plugin:require-path-exists/recommended"
|
||||
"plugin:require-path-exists/recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"plugins": ["json", "require-path-exists"],
|
||||
"plugins": ["json", "require-path-exists", "@typescript-eslint"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 13,
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
// "parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"json/*": ["error"],
|
||||
"indent": ["off"], //handled by prettier
|
||||
|
|
@ -33,15 +36,41 @@
|
|||
{ "allowTemplateLiterals": true, "avoidEscape": true }
|
||||
],
|
||||
"semi": ["error", "always"],
|
||||
"no-unused-vars": ["error", { "argsIgnorePattern": "^(_|e|event)" }],
|
||||
"no-empty": ["error", { "allowEmptyCatch": true }],
|
||||
"no-unused-vars": ["error", { "argsIgnorePattern": "^(_|e|event)" }],
|
||||
"no-var": 2,
|
||||
"require-path-exists/notEmpty": 2,
|
||||
"require-path-exists/tooManyArguments": 2,
|
||||
"require-path-exists/exists": [
|
||||
2,
|
||||
{
|
||||
"extensions": ["", ".ts", ".js", ".es.js", ".json5", ".es", ".es6"]
|
||||
"extensions": [
|
||||
"",
|
||||
".js",
|
||||
".ts",
|
||||
".tsx",
|
||||
".es.ts",
|
||||
".tsx",
|
||||
".json5",
|
||||
".es",
|
||||
".es6",
|
||||
".coffee"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
// enable the rule specifically for TypeScript files
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {
|
||||
"@typescript-eslint/explicit-function-return-type": ["error"],
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-empty-function": "error",
|
||||
"@typescript-eslint/no-unused-vars": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,20 +22,13 @@ task("clean", function () {
|
|||
return src(["./public/"], { allowEmpty: true }).pipe(vinylPaths(del));
|
||||
});
|
||||
|
||||
task("lint-js", function () {
|
||||
return src("./src/js/**/*.js")
|
||||
task("lint", function () {
|
||||
return src(["./src/js/**/*.js", "./src/js/**/*.ts"])
|
||||
.pipe(eslint(eslintConfig))
|
||||
.pipe(eslint.format())
|
||||
.pipe(eslint.failAfterError());
|
||||
});
|
||||
|
||||
task("lint-ts", function () {
|
||||
return src("./src/js/**/*.ts")
|
||||
.pipe(eslint(tsEslintConfig))
|
||||
.pipe(eslint.format())
|
||||
.pipe(eslint.failAfterError());
|
||||
});
|
||||
|
||||
task("lint-json", function () {
|
||||
return src("./static/**/*.json")
|
||||
.pipe(eslint(eslintConfig))
|
||||
|
|
@ -121,8 +114,7 @@ task("updateSwCacheName", function () {
|
|||
task(
|
||||
"compile",
|
||||
series(
|
||||
"lint-js",
|
||||
"lint-ts",
|
||||
"lint",
|
||||
"lint-json",
|
||||
"browserify",
|
||||
"static",
|
||||
|
|
@ -133,8 +125,7 @@ task(
|
|||
|
||||
task("watch", function () {
|
||||
watch("./src/sass/**/*.scss", series("sass"));
|
||||
watch("./src/js/**/*.js", series("lint-js", "browserify"));
|
||||
watch("./src/js/**/*.ts", series("lint-ts", "browserify"));
|
||||
watch(["./src/js/**/*.js", "./src/js/**/*.ts"], series("lint", "browserify"));
|
||||
watch("./static/**/*.*", series("lint-json", "static"));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,18 +16,14 @@
|
|||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:json/recommended",
|
||||
"plugin:require-path-exists/recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
"plugin:require-path-exists/recommended"
|
||||
],
|
||||
"plugins": ["json", "require-path-exists", "@typescript-eslint"],
|
||||
"plugins": ["json", "require-path-exists"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"ecmaVersion": 13,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"json/*": ["error"],
|
||||
"indent": ["off"], //handled by prettier
|
||||
"linebreak-style": ["error", "unix"],
|
||||
|
|
@ -37,25 +33,14 @@
|
|||
{ "allowTemplateLiterals": true, "avoidEscape": true }
|
||||
],
|
||||
"semi": ["error", "always"],
|
||||
"no-unused-vars": ["error", { "argsIgnorePattern": "^(_|e|event)" }],
|
||||
"no-empty": ["error", { "allowEmptyCatch": true }],
|
||||
"no-var": 2,
|
||||
"require-path-exists/notEmpty": 2,
|
||||
"require-path-exists/tooManyArguments": 2,
|
||||
"require-path-exists/exists": [
|
||||
2,
|
||||
{
|
||||
"extensions": [
|
||||
"",
|
||||
".js",
|
||||
".ts",
|
||||
".tsx",
|
||||
".es.ts",
|
||||
".tsx",
|
||||
".json5",
|
||||
".es",
|
||||
".es6",
|
||||
".coffee"
|
||||
]
|
||||
"extensions": ["", ".ts", ".js", ".es.js", ".json5", ".es", ".es6"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue