2024-02-22 09:24:20 +08:00
|
|
|
import eslint, { format, failAfterError } from "gulp-eslint-new";
|
|
|
|
import gulp from "gulp";
|
|
|
|
import {
|
|
|
|
validateAll,
|
|
|
|
validateQuotes,
|
|
|
|
validateLanguages,
|
|
|
|
validateOthers,
|
|
|
|
} from "./scripts/json-validation.cjs";
|
2022-02-13 04:02:29 +08:00
|
|
|
const eslintConfig = "../.eslintrc.json";
|
2020-11-13 15:12:53 +08:00
|
|
|
|
2024-02-22 09:24:20 +08:00
|
|
|
const { task, src, series } = gulp;
|
|
|
|
|
2022-02-12 06:34:40 +08:00
|
|
|
task("lint", function () {
|
2022-09-22 19:42:54 +08:00
|
|
|
return src(["./src/ts/**/*.ts"])
|
2022-02-08 01:44:45 +08:00
|
|
|
.pipe(eslint(eslintConfig))
|
2024-02-22 09:24:20 +08:00
|
|
|
.pipe(format())
|
|
|
|
.pipe(failAfterError());
|
2022-02-08 01:44:45 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
task("lint-json", function () {
|
2022-09-22 19:42:54 +08:00
|
|
|
return src("./static/**/*.json")
|
2022-02-08 01:16:38 +08:00
|
|
|
.pipe(eslint(eslintConfig))
|
2024-02-22 09:24:20 +08:00
|
|
|
.pipe(format())
|
|
|
|
.pipe(failAfterError());
|
2022-02-08 01:16:38 +08:00
|
|
|
});
|
|
|
|
|
2022-02-18 06:36:40 +08:00
|
|
|
task("validate-json-schema", function () {
|
2024-02-22 09:24:20 +08:00
|
|
|
return validateAll();
|
2020-11-03 09:53:53 +08:00
|
|
|
});
|
|
|
|
|
2022-02-19 02:25:33 +08:00
|
|
|
//PR CHECK
|
2022-02-19 01:14:39 +08:00
|
|
|
|
2024-02-22 09:24:20 +08:00
|
|
|
task("pr-check-quote-json", function () {
|
|
|
|
return validateQuotes();
|
2022-02-19 02:25:33 +08:00
|
|
|
});
|
2024-02-22 09:24:20 +08:00
|
|
|
task("pr-check-language-json", function () {
|
|
|
|
return validateLanguages();
|
2022-02-19 02:25:33 +08:00
|
|
|
});
|
2024-02-22 09:24:20 +08:00
|
|
|
task("pr-check-other-json", function () {
|
|
|
|
return validateOthers();
|
2022-02-19 02:25:33 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
task("pr-check-lint", series("lint"));
|