Skip to content

Commit 9b36f1b

Browse files
committed
test: add eslint
1 parent 67fc97f commit 9b36f1b

15 files changed

Lines changed: 423 additions & 98 deletions

File tree

.eslintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"es2020": true,
6+
"node": true
7+
},
8+
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
9+
"parserOptions": {
10+
"ecmaFeatures": {
11+
"jsx": true
12+
},
13+
"ecmaVersion": 11,
14+
"sourceType": "module"
15+
},
16+
"settings": {
17+
"react": {
18+
"version": "detect"
19+
}
20+
},
21+
"plugins": ["react"],
22+
"rules": {
23+
"react/prop-types": "off",
24+
"react/display-name": "off"
25+
}
26+
}

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
GITHUB_USER_PERSONAL_ACCESS_TOKEN: ${{ secrets.USER_PAT }}
2525
- run: |
2626
npm install
27+
npm run lint
2728
npm run build
2829
git config user.name "${{ secrets.USER_NAME }}"
2930
git config user.email "${{ secrets.USER_EMAIL }}"

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ jobs:
2020
with:
2121
GITHUB_USER_PERSONAL_ACCESS_TOKEN: ${{ secrets.USER_PAT }}
2222
- run: npm install
23+
- run: npm run lint
2324
- run: npm run build

build/.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"extends": ["eslint:recommended", "prettier"],
6+
"parserOptions": {
7+
"ecmaVersion": 11,
8+
"sourceType": "module"
9+
},
10+
"rules": {}
11+
}

build/create-testcases.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function init(program) {
6060
* -> get code snippets
6161
* -> and their relevant titles
6262
*/
63-
for (const { frontmatter, body, markdownAST } of rulesData) {
63+
for (const { frontmatter, markdownAST } of rulesData) {
6464
const { id: ruleId, name: ruleName, accessibility_requirements: ruleAccessibilityRequirements } = frontmatter
6565

6666
/**

build/get-implementations.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ async function init({ implementationsFile }) {
3737
execCommand(`mkdir -p "./_data/implementations"`)
3838

3939
for (const { organisation, toolName, jsonReports, testcases: actTestcases, output, description } of implementations) {
40-
try {
41-
const earlReports = await loadJson(jsonReports)
42-
const [testcases] = await loadJson(actTestcases)
43-
const mapping = await actMapGenerator(earlReports, testcases, { organisation, toolName })
44-
const result = {
45-
...mapping,
46-
description,
47-
}
48-
await createFile(output, JSON.stringify(result, undefined, 2))
49-
console.info(`Generated implementations for ${toolName} from ${organisation}`)
50-
} catch (error) {
51-
throw error
40+
const earlReports = await loadJson(jsonReports)
41+
const [testcases] = await loadJson(actTestcases)
42+
const mapping = await actMapGenerator(earlReports, testcases, { organisation, toolName })
43+
const result = {
44+
...mapping,
45+
description,
5246
}
47+
await createFile(output, JSON.stringify(result, undefined, 2))
48+
console.info(`Generated implementations for ${toolName} from ${organisation}`)
5349
}
5450
}
5551

gatsby/get-node-data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const getNodeData = async options => {
2222
}
2323

2424
switch (sourceInstanceName) {
25-
case 'rules':
25+
case 'rules': {
2626
const { id } = attributes
2727
const path = `${sourceInstanceName}/${id}`
2828
const gitUrl = `https://api.github.com/repos/act-rules/act-rules.github.io/commits?path=_rules/${relativePath}`
@@ -33,6 +33,7 @@ const getNodeData = async options => {
3333
path,
3434
changelog: JSON.stringify(logs),
3535
}
36+
}
3637
default:
3738
return {
3839
...defaults,

0 commit comments

Comments
 (0)