Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ jobs:
- name: Build & Verify
run: npm run build && git diff --exit-code

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/cache@v4
with:

path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint

unit:
name: Unit tests
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
arrowParens: 'always',
bracketSpacing: true,
printWidth: 200,
printWidth: 100,
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
Expand Down
13 changes: 6 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10078,7 +10078,9 @@ async function downloadCLI(url, checksums) {
const checksum = await fileSHA256(pathToCLIZip);

if (!checksums.includes(checksum)) {
throw new Error(`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`);
throw new Error(
`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`,
);
}

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

async function installWrapper(pathToCLI) {
// Move the original tflint binary to a new location
await io.mv(
external_path_.join(pathToCLI, 'tflint'),
external_path_.join(pathToCLI, 'tflint-bin')
);
await io.mv(external_path_.join(pathToCLI, 'tflint'), external_path_.join(pathToCLI, 'tflint-bin'));

// Copy the wrapper script to the tflint binary location
await io.cp(
__nccwpck_require__.ab + "index1.js",
external_path_.join(pathToCLI, 'tflint')
external_path_.join(pathToCLI, 'tflint'),
);

// Copy the wrapper script package.json to the tflint binary location
await io.cp(
__nccwpck_require__.ab + "package.json",
external_path_.join(pathToCLI, 'package.json')
external_path_.join(pathToCLI, 'package.json'),
);

core.exportVariable('TFLINT_CLI_PATH', pathToCLI);
Expand Down
13 changes: 12 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,18 @@ export default [
{
blankLine: 'always',

prev: ['directive', 'block', 'block-like', 'multiline-block-like', 'cjs-export', 'cjs-import', 'class', 'export', 'import', 'if'],
prev: [
'directive',
'block',
'block-like',
'multiline-block-like',
'cjs-export',
'cjs-import',
'class',
'export',
'import',
'if',
],

next: '*',
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"type": "module",
"scripts": {
"lint": "eslint --fix . src",
"lint": "eslint",
"build": "ncc build wrapper/tflint.js --out wrapper/dist && ncc build index.js -o dist --no-source-map-register",
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
Expand Down
13 changes: 6 additions & 7 deletions src/setup-tflint.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ async function downloadCLI(url, checksums) {
const checksum = await fileSHA256(pathToCLIZip);

if (!checksums.includes(checksum)) {
throw new Error(`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`);
throw new Error(
`Mismatched checksum: expected one of ${checksums.join(', ')}, but got ${checksum}`,
);
}

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

async function installWrapper(pathToCLI) {
// Move the original tflint binary to a new location
await io.mv(
path.join(pathToCLI, 'tflint'),
path.join(pathToCLI, 'tflint-bin')
);
await io.mv(path.join(pathToCLI, 'tflint'), path.join(pathToCLI, 'tflint-bin'));

// Copy the wrapper script to the tflint binary location
await io.cp(
path.resolve(path.join(__dirname, '..', 'wrapper', 'dist', 'index.js')),
path.join(pathToCLI, 'tflint')
path.join(pathToCLI, 'tflint'),
);

// Copy the wrapper script package.json to the tflint binary location
await io.cp(
path.resolve(path.join(__dirname, '..', 'wrapper', 'dist', 'package.json')),
path.join(pathToCLI, 'package.json')
path.join(pathToCLI, 'package.json'),
);

core.exportVariable('TFLINT_CLI_PATH', pathToCLI);
Expand Down
Loading