Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tools: refactor lint-sh.js to esm module
  • Loading branch information
F3n67u committed May 2, 2022
commit fda18c4734417cf18fc5fb403daf9eb8289ecc43
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
persist-credentials: false
- run: shellcheck -V
- name: Lint Shell scripts
run: tools/lint-sh.js .
run: tools/lint-sh.mjs .
lint-codeowners:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
Expand Down
16 changes: 10 additions & 6 deletions tools/lint-sh.js → tools/lint-sh.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env node
'use strict';

const { execSync, spawn } = require('child_process');
const { promises: fs, readdirSync, statSync } = require('fs');
const { extname, join, relative, resolve } = require('path');
import { execSync, spawn } from 'child_process';
import { promises as fs, readdirSync, statSync } from 'fs';
import { extname, join, relative, resolve } from 'path';
import process from 'process';
Comment thread
F3n67u marked this conversation as resolved.
Outdated

const FIX_MODE_ENABLED = process.argv.includes('--fix');
const USE_NPX = process.argv.includes('--from-npx');
Expand Down Expand Up @@ -178,7 +178,11 @@ if (
SPAWN_OPTIONS.cwd = process.cwd();
checkFiles(entryPoint).catch(onError);
} else {
onError(new Error('You must provide a valid directory or file path. ' +
`Received '${process.argv[2]}'.`));
onError(
new Error(
'You must provide a valid directory or file path. ' +
`Received '${process.argv[2]}'.`
)
);
Comment thread
F3n67u marked this conversation as resolved.
Outdated
}
}