Skip to content

Commit d175c5b

Browse files
raifdmuellerclaude
andcommitted
feat: Add ESLint coverage for scripts/ directory (#81 follow-up)
- Add scripts/eslint.config.mjs (Node.js/CommonJS environment, flat config) - Add eslint + @eslint/js devDependencies to scripts/package.json - Add 'lint' script to scripts/package.json - Extend CI lint job to run ESLint on scripts/ as well - Fix lint issues found: unnecessary regex escapes in generate-llms-txt.js and split-readme.js, rename caught error var to _error in split-readme.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent efd6e00 commit d175c5b

6 files changed

Lines changed: 962 additions & 8 deletions

File tree

.github/workflows/test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@ jobs:
2626
working-directory: ./website
2727
run: npm ci
2828

29-
- name: Run ESLint
29+
- name: Run ESLint (website)
3030
working-directory: ./website
3131
run: npm run lint
3232

3333
- name: Check Prettier formatting
3434
working-directory: ./website
3535
run: npm run format:check
3636

37+
- name: Install scripts dependencies
38+
working-directory: ./scripts
39+
run: npm ci
40+
41+
- name: Run ESLint (scripts)
42+
working-directory: ./scripts
43+
run: npm run lint
44+
3745
e2e-tests:
3846
name: E2E Tests
3947
runs-on: ubuntu-latest

scripts/eslint.config.mjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import js from '@eslint/js'
2+
3+
const nodeGlobals = {
4+
require: 'readonly',
5+
module: 'writable',
6+
exports: 'writable',
7+
__dirname: 'readonly',
8+
__filename: 'readonly',
9+
process: 'readonly',
10+
console: 'readonly',
11+
Buffer: 'readonly',
12+
}
13+
14+
export default [
15+
js.configs.recommended,
16+
{
17+
files: ['**/*.js'],
18+
languageOptions: {
19+
ecmaVersion: 2022,
20+
sourceType: 'commonjs',
21+
globals: nodeGlobals,
22+
},
23+
rules: {
24+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }],
25+
'no-console': 'off',
26+
},
27+
},
28+
]

scripts/generate-llms-txt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function adocToMarkdown(adoc) {
101101
md = md.replace(/^\+\s*$/gm, '')
102102

103103
// Links: link:url[text] → [text](url), resolve relative .adoc paths to GitHub URLs
104-
md = md.replace(/link:([^\[]+)\[([^\]]*)\]/g, (_, url, text) => {
104+
md = md.replace(/link:([^[]+)\[([^\]]*)\]/g, (_, url, text) => {
105105
if (/^\.\.\/.*\.adoc$/.test(url)) {
106106
url = 'https://github.com/LLM-Coding/Semantic-Anchors/blob/main/' + url.slice(3)
107107
}

0 commit comments

Comments
 (0)