diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae72b21f..013d7afb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.prettierrc.js b/.prettierrc.js index a7c08835..e3228dc0 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,7 +1,7 @@ export default { arrowParens: 'always', bracketSpacing: true, - printWidth: 200, + printWidth: 100, quoteProps: 'as-needed', semi: true, singleQuote: true, diff --git a/dist/index.js b/dist/index.js index 6fcced33..51df506c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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'); @@ -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); diff --git a/eslint.config.js b/eslint.config.js index ad21b961..4319d3c6 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -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: '*', }, diff --git a/package.json b/package.json index 8a8604c8..0c305b22 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/setup-tflint.js b/src/setup-tflint.js index 3a694044..cc1ba8f5 100644 --- a/src/setup-tflint.js +++ b/src/setup-tflint.js @@ -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'); @@ -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);