Unverified 提交 371df0e9 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Get rid of .eslintignore and .prettierignore (#1395)

Instead of ignoring complex paths, be explicit in what ESLint and Prettier must check.
上级 f1973891
# NOTE: This file and .prettierignore must contain same paths.
/.cache
/art
/coverage
/node/lib
/node/src/fbs
/rust
/target
/worker/deps
/worker/fbs
/worker/fuzzer
/worker/include
/worker/prebuild
/worker/pip_invoke
/worker/src
/worker/subprojects
/worker/test
/worker/out
/NO_GIT
# NOTE: This file and .eslintignore must contain same paths.
/.cache
/art
/coverage
/node/lib
/node/src/fbs
/rust
/target
/worker/deps
/worker/fbs
/worker/fuzzer
/worker/include
/worker/prebuild
/worker/pip_invoke
/worker/src
/worker/subprojects
/worker/test
/worker/out
/NO_GIT
......@@ -25,6 +25,28 @@ const WORKER_PREBUILD_TAR_PATH = `${WORKER_PREBUILD_DIR}/${WORKER_PREBUILD_TAR}`
const GH_OWNER = 'versatica';
const GH_REPO = 'mediasoup';
// Paths for ESLint to check. Converted to string for convenience.
const ESLINT_PATHS = ['node/src', 'npm-scripts.mjs', 'worker/scripts'].join(
' '
);
// Paths for ESLint to ignore. Converted to string argument for convenience.
const ESLINT_IGNORE_PATTERN_ARGS = ['node/src/fbs']
.map(entry => `--ignore-pattern ${entry}`)
.join(' ');
// Paths for Prettier to check/write. Converted to string for convenience.
// NOTE: Prettier ignores paths in .gitignore so we don't need to care about
// node/src/fbs.
const PRETTIER_PATHS = [
'CHANGELOG.md',
'CONTRIBUTING.md',
'README.md',
'doc',
'node/src',
'npm-scripts.mjs',
'package.json',
'worker/scripts',
].join(' ');
const task = process.argv[2];
const args = process.argv.slice(3).join(' ');
......@@ -331,13 +353,15 @@ function cleanWorkerArtifacts() {
function lintNode() {
logInfo('lintNode()');
executeCmd('prettier . --check');
// Ensure there are no rules that are unnecessary or conflict with Prettier
// rules.
executeCmd('eslint-config-prettier .eslintrc.js');
executeCmd('eslint -c .eslintrc.js --max-warnings 0 .');
executeCmd(
`eslint -c .eslintrc.js --ext=ts,js,mjs --max-warnings 0 ${ESLINT_IGNORE_PATTERN_ARGS} ${ESLINT_PATHS}`
);
executeCmd(`prettier --check ${PRETTIER_PATHS}`);
}
function lintWorker() {
......@@ -351,7 +375,7 @@ function lintWorker() {
function formatNode() {
logInfo('formatNode()');
executeCmd('prettier . --write');
executeCmd(`prettier --write ${PRETTIER_PATHS}`);
}
function flatcNode() {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论