Skip to content

Commit d34da14

Browse files
committed
tools: refactor lint-sh.js to esm module
1 parent 1d8a320 commit d34da14

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.github/workflows/linters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
env:
18-
PYTHON_VERSION: '3.10'
18+
PYTHON_VERSION: "3.10"
1919
NODE_VERSION: lts/*
2020

2121
jobs:
@@ -156,7 +156,7 @@ jobs:
156156
persist-credentials: false
157157
- run: shellcheck -V
158158
- name: Lint Shell scripts
159-
run: tools/lint-sh.js .
159+
run: tools/lint-sh.mjs .
160160
lint-codeowners:
161161
if: github.event.pull_request.draft == false
162162
runs-on: ubuntu-latest

tools/lint-sh.js renamed to tools/lint-sh.mjs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env node
2-
'use strict';
32

4-
const { execSync, spawn } = require('child_process');
5-
const { promises: fs, readdirSync, statSync } = require('fs');
6-
const { extname, join, relative, resolve } = require('path');
3+
import { execSync, spawn } from 'child_process';
4+
import { promises as fs, readdirSync, statSync } from 'fs';
5+
import { extname, join, relative, resolve } from 'path';
6+
import process from 'process';
77

88
const FIX_MODE_ENABLED = process.argv.includes('--fix');
99
const USE_NPX = process.argv.includes('--from-npx');
@@ -178,7 +178,11 @@ if (
178178
SPAWN_OPTIONS.cwd = process.cwd();
179179
checkFiles(entryPoint).catch(onError);
180180
} else {
181-
onError(new Error('You must provide a valid directory or file path. ' +
182-
`Received '${process.argv[2]}'.`));
181+
onError(
182+
new Error(
183+
'You must provide a valid directory or file path. ' +
184+
`Received '${process.argv[2]}'.`
185+
)
186+
);
183187
}
184188
}

0 commit comments

Comments
 (0)