Skip to content

Commit d0413d6

Browse files
committed
fix: lint
1 parent 9ef4451 commit d0413d6

File tree

132 files changed

+1947
-2157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1947
-2157
lines changed

.eslintignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
node_modules/
3+
lib/
4+
dist/
5+
build/
6+
tests/
7+
coverage/
8+
demo/
9+
es/
10+
.rax/
11+
.ice/
12+
scripts/*.js

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-env node,browser */
2+
module.exports = {
3+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
4+
parser: '@typescript-eslint/parser',
5+
plugins: ['@typescript-eslint'],
6+
root: true,
7+
rules: {
8+
'@typescript-eslint/no-explicit-any': 'warn',
9+
},
10+
env: {
11+
browser: true,
12+
node: true,
13+
}
14+
};

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
npm install
1919
npm run build
2020
npm run type-check
21+
npm run lint
2122
npm run coverage
2223
- name: Upload coverage
2324
uses: codecov/codecov-action@v3

declarations.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
declare module '*.css'
1+
declare module '*.css'

e2e/toolbar.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ describe('toolbar.test', () => {
66
}, 20 * 1000);
77

88
const clickToolbar = async function (selector: string) {
9-
await page.click(selector);
9+
await __browserPage.click(selector);
1010
await sleep(1000);
11-
const result = await page.$eval(selector, (element) => element.className);
11+
const result = await __browserPage.$eval(selector, (element) => element.className);
1212
return result.split(' ').length > 1;
1313
};
1414
for (const item of ['bold', 'italic', 'wrap-text']) {
1515
test(`test toolbar ${item}`, async () => {
16-
expect(
17-
await clickToolbar(getTestIdSelector(`toolbar-${item}`)),
18-
).toBeTruthy();
16+
expect(await clickToolbar(getTestIdSelector(`toolbar-${item}`))).toBeTruthy();
1917
});
2018
}
2119
});

e2e/util.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as puppeteer from 'puppeteer';
22

33
declare global {
4-
var page: puppeteer.Page;
4+
// eslint-disable-next-line no-var
5+
var __browserPage: puppeteer.Page;
56
}
67

78
async function setupPuppeteer() {
@@ -13,20 +14,22 @@ async function setupPuppeteer() {
1314
height: 800,
1415
},
1516
});
16-
global.page = await browser.newPage();
17+
__browserPage = await browser.newPage();
1718
}
1819

19-
export function sleep(milliseconds: number) {
20+
export function sleep(milliseconds: number): Promise<unknown> {
2021
return new Promise((resolve) => setTimeout(resolve, milliseconds));
2122
}
2223

23-
export async function openPage() {
24+
export async function openPage(): Promise<void> {
2425
await setupPuppeteer();
25-
const filePath = `http://localhost:8000`;
26-
await page.goto(filePath);
26+
const port = 8000;
27+
const filePath = `https://localhost:${port}`;
28+
console.log(filePath);
29+
await __browserPage.goto(filePath);
2730
await sleep(1000);
2831
}
2932

30-
export function getTestIdSelector(testId: string) {
33+
export function getTestIdSelector(testId: string): string {
3134
return `[data-testid="${testId}"]`;
3235
}

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
"build": "node ./scripts/esbuild.js",
1010
"test": "jest --config ./scripts/unit-test-jest.config.js --detectOpenHandles",
1111
"coverage": "npm run test -- --coverage",
12-
"ci": "npm run test && npm run type-check && npm run build && npm run e2e",
12+
"ci": "npm run test && npm run type-check && npm run build && npm run e2e && npm run lint",
1313
"type-check": "npx tsc",
1414
"postinstall": "node ./post-install.js",
1515
"prebuild": "node ./post-install.js",
16-
"e2e": "jest --config ./scripts/e2e-jest.config.js --forceExit --detectOpenHandles"
16+
"e2e": "jest --config ./scripts/e2e-jest.config.js --forceExit --detectOpenHandles",
17+
"lint": "eslint --fix --quiet --ext .ts,.tsx ./"
1718
},
1819
"repository": {
1920
"type": "git",
@@ -29,8 +30,11 @@
2930
"@types/jest": "29.5.8",
3031
"@types/react": "18.2.37",
3132
"@types/react-dom": "18.2.15",
33+
"@typescript-eslint/eslint-plugin": "^6.11.0",
34+
"@typescript-eslint/parser": "^6.11.0",
3235
"canvas": "2.11.2",
3336
"esbuild": "0.19.5",
37+
"eslint": "^8.54.0",
3438
"jest": "29.7.0",
3539
"jest-environment-jsdom": "29.7.0",
3640
"puppeteer": "21.5.2",
@@ -45,4 +49,4 @@
4549
"react": "18.2.0",
4650
"react-dom": "18.2.0"
4751
}
48-
}
52+
}

0 commit comments

Comments
 (0)