Skip to content

Commit 72c3400

Browse files
update eslint to v9 (#22)
1 parent 4e59241 commit 72c3400

26 files changed

+2937
-2621
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/ci-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
- run: npm ci
2020
- run: sudo apt-get install libgtest-dev
2121

22-
- run: npm run lint
2322
- run: npm run build
23+
- run: npm run lint
2424
- run: npm run test

assembly/.eslintrc.cjs

Lines changed: 0 additions & 34 deletions
This file was deleted.

assembly/eslint.config.mjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import tseslint from "typescript-eslint";
2+
import prettier from "eslint-plugin-prettier";
3+
import path from "path";
4+
import { fileURLToPath } from "url";
5+
6+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
7+
8+
export default tseslint.config(
9+
{
10+
ignores: ["*.mjs"],
11+
},
12+
tseslint.configs.recommendedTypeChecked,
13+
{
14+
languageOptions: {
15+
parserOptions: {
16+
tsconfigRootDir: __dirname,
17+
project: [path.join(__dirname, "tsconfig.json")],
18+
},
19+
},
20+
},
21+
22+
{
23+
plugins: {
24+
prettier: prettier,
25+
},
26+
},
27+
28+
{
29+
rules: {
30+
// Namespaces are quite useful in AssemblyScript
31+
"@typescript-eslint/no-namespace": "off",
32+
33+
// There is actually codegen difference here
34+
"@typescript-eslint/no-array-constructor": "off",
35+
36+
// Sometimes it can't be avoided to add a @ts-ignore
37+
"@typescript-eslint/ban-ts-comment": "off",
38+
39+
// Not all types can be omitted in AS yet
40+
"@typescript-eslint/no-inferrable-types": "off",
41+
42+
// The compiler has its own `Function` class for example
43+
"@typescript-eslint/ban-types": "off",
44+
"@typescript-eslint/no-unsafe-call": "off",
45+
},
46+
},
47+
);

eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { baseConfig } from "@schleifner/eslint-config-base/config.mjs";
2+
export default [
3+
{
4+
ignores: [
5+
"dist/", // exclude specific folder
6+
"**/*.mjs", // exclude all JavaScript files
7+
],
8+
},
9+
...baseConfig,
10+
];
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export default initInstrumenter;
2+
3+
interface Instrumenter {
4+
allocateUTF8(str: string): number;
5+
_wasm_instrument(
6+
fileName: number,
7+
targetName: number,
8+
reportFunction: number,
9+
sourceMap: number,
10+
expectInfoOutputFilePath: number,
11+
debugInfoOutputFilePath: number,
12+
includes: number,
13+
excludes: number,
14+
skipLib: boolean
15+
): void;
16+
_free(ptr: number): void;
17+
}
18+
19+
declare function initInstrumenter(initInstrumenter?: {}): Promise<Instrumenter>;

jest.config.ts renamed to jest.config.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import type { JestConfigWithTsJest } from "ts-jest";
2-
3-
const config: JestConfigWithTsJest = {
1+
const config = {
42
roots: ["tests/ts"],
53
extensionsToTreatAsEsm: [".ts"],
64
verbose: true,
@@ -12,10 +10,11 @@ const config: JestConfigWithTsJest = {
1210
transform: {
1311
"^.+\\.(ts|tsx)?$": ["ts-jest", { useESM: true }],
1412
},
13+
transformIgnorePatterns: ["<rootDir>/third_party"],
1514
moduleNameMapper: {
1615
"^(\\.{1,2}/.*)\\.js$": "$1",
1716
},
18-
testPathIgnorePatterns: ["./dist"],
17+
testPathIgnorePatterns: ["/dist/", "/third_party/", "/node_modules/"],
1918
testTimeout: 10000,
2019
};
2120

0 commit comments

Comments
 (0)