Skip to content

Commit 7118ff7

Browse files
authored
Merge pull request #1427 from dtolnay/eslint
Set up ESLint
2 parents 12e0f69 + e9b06f3 commit 7118ff7

File tree

5 files changed

+1086
-1
lines changed

5 files changed

+1086
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ jobs:
176176
- name: Run clang-tidy
177177
run: clang-tidy-18 src/cxx.cc --warnings-as-errors=*
178178

179+
eslint:
180+
name: ESLint
181+
runs-on: ubuntu-latest
182+
if: github.event_name != 'pull_request'
183+
timeout-minutes: 45
184+
steps:
185+
- uses: actions/checkout@v4
186+
- run: npm install
187+
working-directory: book
188+
- run: npx eslint
189+
working-directory: book
190+
179191
outdated:
180192
name: Outdated
181193
runs-on: ubuntu-latest

book/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const dirs = ['build'];
3939
while (dirs.length) {
4040
const dir = dirs.pop();
4141
fs.readdirSync(dir).forEach((entry) => {
42-
path = dir + '/' + entry;
42+
const path = dir + '/' + entry;
4343
const stat = fs.statSync(path);
4444
if (stat.isDirectory()) {
4545
dirs.push(path);

book/eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import pluginJs from '@eslint/js';
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default [
5+
{ ignores: ['build/*'] },
6+
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
7+
pluginJs.configs.recommended,
8+
];

0 commit comments

Comments
 (0)