Skip to content

Commit 5d64a23

Browse files
author
Sentience Dev
committed
Merge pull request #90 from SentienceAPI/hardening
Hardening & Cleaning code
2 parents ee41118 + 06ae478 commit 5d64a23

Some content is hidden

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

80 files changed

+6754
-1710
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ jobs:
3232
npx playwright install chromium
3333
npx playwright install-deps chromium || true
3434
35+
- name: Lint with ESLint
36+
run: |
37+
npm run lint
38+
39+
- name: Type check
40+
run: |
41+
npm run type-check
42+
43+
- name: Format check
44+
run: |
45+
npm run format-check
46+
3547
- name: Build package
3648
run: |
3749
npm run build

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.ts": ["eslint --fix --max-warnings=-1", "prettier --write"],
3+
"*.{json,md}": ["prettier --write"]
4+
}

.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dist/
2+
node_modules/
3+
*.js
4+
src/extension/
5+
examples/
6+
coverage/
7+
*.min.js
8+
package-lock.json
9+

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"arrowParens": "avoid"
9+
}

eslint.config.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// @ts-check
2+
const eslint = require('@eslint/js');
3+
const tseslint = require('typescript-eslint');
4+
const prettier = require('eslint-plugin-prettier');
5+
const prettierConfig = require('eslint-config-prettier');
6+
7+
module.exports = tseslint.config(
8+
eslint.configs.recommended,
9+
...tseslint.configs.recommendedTypeChecked,
10+
{
11+
languageOptions: {
12+
parser: tseslint.parser,
13+
parserOptions: {
14+
project: './tsconfig.json',
15+
ecmaVersion: 2020,
16+
sourceType: 'module',
17+
},
18+
},
19+
plugins: {
20+
prettier: prettier,
21+
},
22+
rules: {
23+
...prettierConfig.rules,
24+
'@typescript-eslint/no-explicit-any': 'off', // Many any types in codebase, will fix incrementally
25+
'@typescript-eslint/no-unsafe-assignment': 'off', // Will fix incrementally
26+
'@typescript-eslint/no-unsafe-member-access': 'off', // Will fix incrementally
27+
'@typescript-eslint/no-unsafe-call': 'off', // Will fix incrementally
28+
'@typescript-eslint/no-unsafe-return': 'off', // Will fix incrementally
29+
'@typescript-eslint/no-unsafe-argument': 'off', // Will fix incrementally
30+
'@typescript-eslint/restrict-template-expressions': 'off', // Will fix incrementally
31+
'@typescript-eslint/unbound-method': 'off', // Will fix incrementally
32+
'@typescript-eslint/require-await': 'warn', // Allow async without await
33+
'@typescript-eslint/no-misused-promises': 'warn', // Allow promises in callbacks
34+
'@typescript-eslint/explicit-function-return-type': 'off',
35+
'no-case-declarations': 'off', // Allow declarations in case blocks
36+
'@typescript-eslint/no-unused-vars': [
37+
'warn', // Changed to warn for now
38+
{
39+
argsIgnorePattern: '^_',
40+
varsIgnorePattern: '^_',
41+
},
42+
],
43+
'prettier/prettier': 'error',
44+
},
45+
},
46+
{
47+
ignores: [
48+
'dist/**',
49+
'node_modules/**',
50+
'*.js',
51+
'src/extension/**',
52+
'examples/**',
53+
'tests/**',
54+
],
55+
}
56+
);
57+

0 commit comments

Comments
 (0)