Skip to content

Commit

Permalink
Run eslint on the scripts directory
Browse files Browse the repository at this point in the history
I noticed that the `scripts` directory, which begins to have a lot of
files as we automate more tasks (like #1524), wasn't linted.

That directory contains code in two languages BASH and JS (Node.js),
with a move to prefer JS files (as it's a JS/TS project).

So I chose to add an `.eslintrc.js` file (which is a deprecated format
but I couldn't make the new one work) and lint script on that
directory.

I subsequently fixed some linting errors.

For now, that script isn't run by our GitHub actions, I will see whether
we can do an intelligent kind of runner which detects if scripts have
been updated.
  • Loading branch information
peaBerberian committed Sep 4, 2024
1 parent e5894f8 commit 51f3bd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions demo/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module.exports = {
env: {
es6: true,
browser: true,
commonjs: true,
mocha: true,
},

globals: {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"bundle:watch": "./scripts/run_bundler.mjs src/index.ts --production-mode -o dist/rx-player.js --watch",
"certificate": "./scripts/generate_certificate",
"check": "npm run check:types && npm run lint && npm run check:types:unit_tests",
"check:all": "npm run check:types && npm run lint && npm run lint:demo && npm run lint:tests && npm run test:unit && npm run test:integration && npm run test:memory && node -r esm ./scripts/check_nodejs_import_compatibility.js",
"check:all": "npm run check:types && npm run lint && npm run lint:demo && npm run lint:tests && npm run lint:scripts && npm run test:unit && npm run test:integration && npm run test:memory && node -r esm ./scripts/check_nodejs_import_compatibility.js",
"check:demo": "npm run check:demo:types && npm run lint:demo",
"check:demo:types": "tsc --noEmit --project demo/",
"clean:build": "scripts/remove_dir.mjs dist",
Expand All @@ -169,6 +169,7 @@
"fmt:rust:check": "cd ./src/parsers/manifest/dash/wasm-parser && cargo fmt --check",
"lint": "eslint src -c .eslintrc.js",
"lint:demo": "eslint -c demo/.eslintrc.js demo/scripts",
"lint:scripts": "eslint -c scripts/.eslintrc.js --ext .js --ext .mjs --ext .cjs scripts",
"lint:tests": "eslint tests/**/*.js --ignore-pattern '/tests/performance/bundle*'",
"list": "node scripts/list-npm-scripts.mjs",
"prepublishOnly": "npm run build:all",
Expand Down
6 changes: 4 additions & 2 deletions scripts/run_bundler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ if (import.meta.url === pathToFileURL(process.argv[1]).href) {
}

try {
await runBundler(normalizedPath, {
runBundler(normalizedPath, {
watch: shouldWatch,
minify: shouldMinify,
production,
silent,
outfile,
}).catch((err) => {
console.error(`ERROR: ${err}\n`);
process.exit(1);
});
} catch (err) {
console.error(`ERROR: ${err}\n`);
displayHelp();
process.exit(1);
}
}
Expand Down

0 comments on commit 51f3bd9

Please sign in to comment.