Skip to content

Commit c5c547c

Browse files
committed
🚨 Linty McLintface
1 parent 0aa00b7 commit c5c547c

File tree

7 files changed

+31
-10
lines changed

7 files changed

+31
-10
lines changed

‎.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
root: true,
3+
extends: ["eslint:recommended"],
4+
parserOptions: {
5+
ecmaVersion: "latest",
6+
sourceType: "module",
7+
},
8+
env: {
9+
es6: true,
10+
node: true,
11+
},
12+
rules: {
13+
"arrow-spacing": "error",
14+
},
15+
};

‎.github/workflows/check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ jobs:
1313
name: 'nvm install lts/* && npm ci'
1414
with:
1515
node-version: lts/*
16+
- run: npm run lint
1617
- run: npm run test
1718
- run: npm run check

‎.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

‎.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"private": true,
33
"scripts": {
44
"check": "node -e 'import(\"./scripts/check-delegates.mjs\").then(cd => cd.checkDelegates())'",
5-
"test": "node ./scripts/check-delegates-test.mjs"
5+
"test": "node ./scripts/check-delegates-test.mjs",
6+
"lint": "eslint . --ext .js --ext .mjs --ext .cjs",
7+
"lint:fix": "eslint . --ext .js --ext .mjs --ext .cjs --fix"
8+
},
9+
"devDependencies": {
10+
"eslint": "^8.41.0"
611
}
712
}

‎scripts/check-delegates-test.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const threeLetter = `Chris de Almeida (CDA)\nRob Palmer (ROBPALMER)\nUjjwal Shar
99
const duplicate = `Chris de Almeida (CDA)\nRob Palmer (RPR)\nUjjwal Sharma (USA)\nUjjwal Sharma (USA)`;
1010
const valid = `Chris de Almeida (CDA)\nRob Palmer (RPR)\nUjjwal Sharma (USA)`;
1111

12-
assert.throws(()=>checkDelegates(lex), { message: /Not in lexicographic order/});
13-
assert.throws(()=>checkDelegates(missing), { message: /Missing abbreviation for/});
14-
assert.throws(()=>checkDelegates(uppercaseLatin), { message: /Abbreviations must be all uppercase Latin letters/});
15-
assert.throws(()=>checkDelegates(twoLetter), { message: /not in allowlist. New delegate abbreviations must be three letters/});
16-
assert.throws(()=>checkDelegates(threeLetter), { message: /New delegate abbreviations must be three letters/});
17-
assert.throws(()=>checkDelegates(duplicate), { message: /Conflicting usage on line/});
12+
assert.throws(() => checkDelegates(lex), { message: /Not in lexicographic order/});
13+
assert.throws(() => checkDelegates(missing), { message: /Missing abbreviation for/});
14+
assert.throws(() => checkDelegates(uppercaseLatin), { message: /Abbreviations must be all uppercase Latin letters/});
15+
assert.throws(() => checkDelegates(twoLetter), { message: /not in allowlist. New delegate abbreviations must be three letters/});
16+
assert.throws(() => checkDelegates(threeLetter), { message: /New delegate abbreviations must be three letters/});
17+
assert.throws(() => checkDelegates(duplicate), { message: /Conflicting usage on line/});
1818

19-
assert.doesNotThrow(()=>checkDelegates(valid));
19+
assert.doesNotThrow(() => checkDelegates(valid));

‎scripts/check-delegates.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function checkDelegates(contents = fs.readFileSync('./delegates.txt', 'ut
3030
for (const line of lines) {
3131
if (line.length === 0) continue;
3232
const match = re.exec(line);
33-
const {name, abbr} = match.groups;
33+
const {abbr} = match.groups;
3434

3535
if (previousLine.localeCompare(line, 'en') > 0) {
3636
throw new Error(`Line ${lineNumber}: Not in lexicographic order.`);

0 commit comments

Comments
 (0)