Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
puzzlet committed Sep 18, 2024
1 parent e803d46 commit 277364d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
with:
cache: 'npm'
- run: npm ci
- run: npm lint
- run: npm run build
- run: npm test
- uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion egyptianNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class EgyptianNumber {

static addAll(...summands: EgyptianNumber[]): EgyptianNumber {
let result = new EgyptianNumber(0);
summands.forEach((summand, i, array) => {
summands.forEach((summand) => {
result = this.add(result, summand);
})
return result;
Expand Down
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
'bundle.mjs',
'build/*',
'docs/_build/*',
'grammar/seshat/*',
]
}
);
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
},
"scripts": {
"antlr4ts": "antlr4ts",

"build": "npm run build-antlr && npm run build-bundle",
"build-antlr": "antlr4ts ./grammar/seshat/SeshatLexer.g4 && antlr4ts ./grammar/seshat/SeshatParser.g4 -visitor -no-listener",
"build-bundle": "node bundle.mjs",
"lint": "eslint .",

"run-dev-server": "node bundle.mjs --serve",

"test": "npm run test-js & npm run test-seshat",
"test-js": "node tests/js/*.mjs",
"test-seshat": "./run-tests.sh"
Expand Down
8 changes: 4 additions & 4 deletions seshatStandardLibrary.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EgyptianNumber } from './egyptianNumber';

type seshatVariable = EgyptianNumber | string;
type SeshatVariable = EgyptianNumber | string;

export function makeSeshatEnvironment(options: {
systemPrint: (...args: any) => void,
systemPrint: (...args: string[]) => void,
systemAssert: (expr: boolean) => void,
}) {
options = {
Expand All @@ -13,7 +13,7 @@ export function makeSeshatEnvironment(options: {
};
return {
EgyptianNumber: EgyptianNumber,
print: (...args: Array<any>) => {
print: (...args: SeshatVariable[]) => {
const processedArgs = args.map(item => {
if (item instanceof EgyptianNumber) {
return item.toHieroglyphs();
Expand All @@ -23,7 +23,7 @@ export function makeSeshatEnvironment(options: {
})
options.systemPrint(...processedArgs);
},
assertEqual: (a: seshatVariable, b: seshatVariable) => {
assertEqual: (a: SeshatVariable, b: SeshatVariable) => {
if (a instanceof EgyptianNumber) {
options.systemAssert((b instanceof EgyptianNumber) && a.isEqualTo(b));
return;
Expand Down

0 comments on commit 277364d

Please sign in to comment.