Skip to content

Commit 2699206

Browse files
authored
lint: run in test workflow (#289)
* lint: run in test workflow * build
1 parent ea09057 commit 2699206

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ jobs:
2525
- name: Build & Verify
2626
run: npm run build && git diff --exit-code
2727

28+
lint:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
- uses: actions/cache@v4
34+
with:
35+
36+
path: ~/.npm
37+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
38+
restore-keys: |
39+
${{ runner.os }}-node-
40+
- run: npm ci
41+
- run: npm run lint
42+
2843
unit:
2944
name: Unit tests
3045
runs-on: ubuntu-latest

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
arrowParens: 'always',
33
bracketSpacing: true,
4-
printWidth: 200,
4+
printWidth: 100,
55
quoteProps: 'as-needed',
66
semi: true,
77
singleQuote: true,

dist/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10078,7 +10078,9 @@ async function downloadCLI(url, checksums) {
1007810078
const checksum = await fileSHA256(pathToCLIZip);
1007910079

1008010080
if (!checksums.includes(checksum)) {
10081-
throw new Error(`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`);
10081+
throw new Error(
10082+
`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`,
10083+
);
1008210084
}
1008310085

1008410086
core.debug('SHA256 hash verified successfully');
@@ -10097,21 +10099,18 @@ async function downloadCLI(url, checksums) {
1009710099

1009810100
async function installWrapper(pathToCLI) {
1009910101
// Move the original tflint binary to a new location
10100-
await io.mv(
10101-
external_path_.join(pathToCLI, 'tflint'),
10102-
external_path_.join(pathToCLI, 'tflint-bin')
10103-
);
10102+
await io.mv(external_path_.join(pathToCLI, 'tflint'), external_path_.join(pathToCLI, 'tflint-bin'));
1010410103

1010510104
// Copy the wrapper script to the tflint binary location
1010610105
await io.cp(
1010710106
__nccwpck_require__.ab + "index1.js",
10108-
external_path_.join(pathToCLI, 'tflint')
10107+
external_path_.join(pathToCLI, 'tflint'),
1010910108
);
1011010109

1011110110
// Copy the wrapper script package.json to the tflint binary location
1011210111
await io.cp(
1011310112
__nccwpck_require__.ab + "package.json",
10114-
external_path_.join(pathToCLI, 'package.json')
10113+
external_path_.join(pathToCLI, 'package.json'),
1011510114
);
1011610115

1011710116
core.exportVariable('TFLINT_CLI_PATH', pathToCLI);

eslint.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,18 @@ export default [
9696
{
9797
blankLine: 'always',
9898

99-
prev: ['directive', 'block', 'block-like', 'multiline-block-like', 'cjs-export', 'cjs-import', 'class', 'export', 'import', 'if'],
99+
prev: [
100+
'directive',
101+
'block',
102+
'block-like',
103+
'multiline-block-like',
104+
'cjs-export',
105+
'cjs-import',
106+
'class',
107+
'export',
108+
'import',
109+
'if',
110+
],
100111

101112
next: '*',
102113
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"type": "module",
77
"scripts": {
8-
"lint": "eslint --fix . src",
8+
"lint": "eslint",
99
"build": "ncc build wrapper/tflint.js --out wrapper/dist && ncc build index.js -o dist --no-source-map-register",
1010
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
1111
},

src/setup-tflint.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ async function downloadCLI(url, checksums) {
7373
const checksum = await fileSHA256(pathToCLIZip);
7474

7575
if (!checksums.includes(checksum)) {
76-
throw new Error(`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`);
76+
throw new Error(
77+
`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`,
78+
);
7779
}
7880

7981
core.debug('SHA256 hash verified successfully');
@@ -92,21 +94,18 @@ async function downloadCLI(url, checksums) {
9294

9395
async function installWrapper(pathToCLI) {
9496
// Move the original tflint binary to a new location
95-
await io.mv(
96-
path.join(pathToCLI, 'tflint'),
97-
path.join(pathToCLI, 'tflint-bin')
98-
);
97+
await io.mv(path.join(pathToCLI, 'tflint'), path.join(pathToCLI, 'tflint-bin'));
9998

10099
// Copy the wrapper script to the tflint binary location
101100
await io.cp(
102101
path.resolve(path.join(__dirname, '..', 'wrapper', 'dist', 'index.js')),
103-
path.join(pathToCLI, 'tflint')
102+
path.join(pathToCLI, 'tflint'),
104103
);
105104

106105
// Copy the wrapper script package.json to the tflint binary location
107106
await io.cp(
108107
path.resolve(path.join(__dirname, '..', 'wrapper', 'dist', 'package.json')),
109-
path.join(pathToCLI, 'package.json')
108+
path.join(pathToCLI, 'package.json'),
110109
);
111110

112111
core.exportVariable('TFLINT_CLI_PATH', pathToCLI);

0 commit comments

Comments
 (0)