Skip to content

Commit c4ab7f5

Browse files
authored
Merge pull request #16 from CodinGame/fix-eslint-ts-config
Fix eslint ts config
2 parents 6ddad8e + bfc6278 commit c4ab7f5

File tree

6 files changed

+55
-146
lines changed

6 files changed

+55
-146
lines changed

.eslintrc.js

Lines changed: 4 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -4,116 +4,19 @@ module.exports = {
44
es6: true
55
},
66
extends: [
7-
'standard', 'standard-jsx'
7+
'@codingame', 'standard-jsx'
88
],
9-
globals: {
10-
Atomics: 'readonly',
11-
SharedArrayBuffer: 'readonly'
12-
},
13-
parser: '@typescript-eslint/parser',
149
parserOptions: {
1510
ecmaFeatures: {
1611
jsx: true
17-
},
18-
ecmaVersion: 2018,
19-
sourceType: 'module',
20-
project: './tsconfig.json'
12+
}
2113
},
2214
plugins: [
2315
'react',
24-
'@typescript-eslint',
25-
'react-hooks',
26-
'unused-imports'
16+
'react-hooks'
2717
],
2818
rules: {
29-
'@typescript-eslint/member-delimiter-style': [
30-
'error',
31-
{
32-
multiline: {
33-
delimiter: 'none'
34-
},
35-
singleline: {
36-
delimiter: 'comma'
37-
}
38-
}
39-
],
40-
'@typescript-eslint/no-misused-promises': [
41-
'error',
42-
{ checksVoidReturn: false }
43-
],
44-
'no-unused-vars': 'off',
45-
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }],
46-
'no-use-before-define': 'off',
47-
'@typescript-eslint/no-use-before-define': [
48-
'error',
49-
{
50-
functions: false,
51-
classes: false,
52-
variables: false
53-
}
54-
],
55-
'@typescript-eslint/no-useless-constructor': 'error',
56-
'@typescript-eslint/type-annotation-spacing': 'error',
57-
'import/named': 'off',
58-
'import/namespace': 'off',
59-
'import/no-unresolved': 'off',
60-
'import/order': [
61-
'warn',
62-
{
63-
groups: ['unknown', 'external', 'internal', 'builtin', 'index', 'sibling', 'parent'],
64-
'newlines-between': 'never'
65-
}
66-
],
67-
'no-console': ['warn', { allow: ['warn', 'error', 'debug', 'info'] }],
68-
'no-useless-constructor': 'off',
69-
'unused-imports/no-unused-imports': 'warn',
70-
'no-redeclare': 'off',
71-
'@typescript-eslint/no-redeclare': ['error'],
72-
'@typescript-eslint/no-unnecessary-condition': 'warn',
73-
'@typescript-eslint/explicit-module-boundary-types': [
74-
'warn',
75-
{
76-
allowArgumentsExplicitlyTypedAsAny: true
77-
}
78-
],
79-
semi: 'off',
80-
'@typescript-eslint/semi': [
81-
'error', 'never'
82-
],
83-
'eslint/no-extra-semi': 'off',
84-
'@typescript-eslint/no-extra-semi': [
85-
'warn'
86-
],
87-
'@typescript-eslint/strict-boolean-expressions': [
88-
'warn',
89-
{
90-
allowString: false,
91-
allowNumber: false,
92-
allowNullableObject: false
93-
}
94-
],
95-
'@typescript-eslint/no-explicit-any': [
96-
'error',
97-
{
98-
ignoreRestArgs: true
99-
}
100-
],
101-
'@typescript-eslint/no-unnecessary-type-assertion': ['error'],
102-
'@typescript-eslint/no-floating-promises': [
103-
'error'
104-
],
105-
'no-void': [
106-
'error',
107-
{
108-
allowAsStatement: true
109-
}
110-
],
111-
'react-hooks/exhaustive-deps': [
112-
'error',
113-
{
114-
additionalHooks: '(useDebouncedCallback)'
115-
}
116-
],
19+
'react-hooks/exhaustive-deps': 'error',
11720
'react-hooks/rules-of-hooks': 'error'
11821
}
11922
}

.github/workflows/check_build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Check build
2-
on: [push]
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
36

47
jobs:
58
check:

package-lock.json

Lines changed: 39 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.0.0-semantic-release",
44
"description": "Monaco Editor React component",
55
"scripts": {
6-
"build": "tsc",
7-
"lint": "npx eslint src/**"
6+
"build": "npm run lint && npm run compile",
7+
"compile": "tsc",
8+
"lint": "npx eslint --ext .ts src"
89
},
910
"repository": {
1011
"type": "git",
@@ -30,6 +31,8 @@
3031
"@babel/preset-react": "7.17.12",
3132
"@babel/preset-typescript": "7.17.12",
3233
"@babel/runtime": "7.18.3",
34+
"@codingame/eslint-config": "^1.1.2",
35+
"@codingame/tsconfig": "^1.0.5",
3336
"@types/deep-equal": "^1.0.1",
3437
"@types/react": "18.0.8",
3538
"@typescript-eslint/eslint-plugin": "5.27.1",
@@ -43,8 +46,7 @@
4346
"eslint-plugin-node": "11.1.0",
4447
"eslint-plugin-promise": "6.0.0",
4548
"eslint-plugin-react": "7.30.0",
46-
"eslint-plugin-react-hooks": "4.5.0",
47-
"eslint-plugin-standard": "5.0.0",
49+
"eslint-plugin-react-hooks": "^4.5.0",
4850
"eslint-plugin-unused-imports": "2.0.0",
4951
"typescript": "4.7.3"
5052
},

src/hooks/useIsUserActive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function useIsUserActive (timeToIdle: number): boolean {
55
const [active, setActive] = useState(true)
66
useEffect(() => {
77
const activityDetector = createActivityDetector({
8-
timeToIdle: timeToIdle
8+
timeToIdle
99
})
1010
activityDetector.on('idle', () => {
1111
setActive(false)

tsconfig.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
{
2+
"extends": "@codingame/tsconfig",
23
"compilerOptions": {
34
"outDir": "dist/",
45
"declaration": true,
56
"skipLibCheck": true,
6-
"allowSyntheticDefaultImports": true,
7-
"strict": true,
87
"baseUrl": "./app",
9-
"esModuleInterop": true,
10-
"forceConsistentCasingInFileNames": true,
11-
"isolatedModules": true,
128
"jsx": "react",
139
"lib": [
1410
"dom",
1511
"dom.iterable",
1612
"esnext"
1713
],
1814
"module": "esnext",
19-
"moduleResolution": "node",
2015
"paths": {
2116
"app/*": [
2217
"*"

0 commit comments

Comments
 (0)