using one eslint config

This commit is contained in:
Miodec 2022-02-11 23:34:40 +01:00
parent 03ff40ca52
commit 63d9287a3a
3 changed files with 45 additions and 40 deletions

View file

@ -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"
}
}
]
}

View file

@ -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"));
});

View file

@ -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"]
}
]
}