Skip to content

Commit daa7bbe

Browse files
authored
Merge pull request #32 from 360Learning/main-eslint
2 parents d91a0fb + e1f5e73 commit daa7bbe

5 files changed

Lines changed: 496 additions & 390 deletions

File tree

.eslintrc.json

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

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 18
19+
cache: npm
20+
- run: npm ci
21+
- run: npm run build
22+
23+
prettier:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 18
30+
cache: npm
31+
- run: npm ci
32+
- run: npm run prettier:check
33+
34+
lint:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 18
41+
cache: npm
42+
- run: npm ci
43+
- run: npm run lint
44+
45+
test:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: 18
52+
cache: npm
53+
- run: npm ci
54+
- run: npm test

eslint.config.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const { FlatCompat } = require('@eslint/eslintrc');
2+
const js = require('@eslint/js');
3+
4+
const compat = new FlatCompat({
5+
baseDirectory: __dirname,
6+
recommendedConfig: js.configs.recommended,
7+
});
8+
9+
module.exports = [
10+
{
11+
ignores: ['**/*.js', 'dist/**'],
12+
},
13+
...compat.config({
14+
env: {
15+
browser: false,
16+
es6: true,
17+
node: true,
18+
},
19+
parser: '@typescript-eslint/parser',
20+
parserOptions: {
21+
project: 'tsconfig.json',
22+
sourceType: 'module',
23+
ecmaVersion: 2022,
24+
},
25+
plugins: ['@typescript-eslint', 'jest'],
26+
extends: [
27+
'eslint:recommended',
28+
'plugin:@typescript-eslint/recommended',
29+
'plugin:jest/recommended',
30+
'prettier',
31+
],
32+
rules: {
33+
'@typescript-eslint/no-unused-vars': [
34+
'error',
35+
{
36+
argsIgnorePattern: '^_.*',
37+
caughtErrorsIgnorePattern: '^_.*',
38+
varsIgnorePattern: '^_.*',
39+
args: 'after-used',
40+
ignoreRestSiblings: true,
41+
},
42+
],
43+
'@typescript-eslint/explicit-function-return-type': 'warn',
44+
'@typescript-eslint/no-explicit-any': 'warn',
45+
'no-console': 'error',
46+
},
47+
}),
48+
];

0 commit comments

Comments
 (0)