Skip to content

Commit 9e30c24

Browse files
committed
ci: stricter linter rules
Signed-off-by: Andres Correa Casablanca <castarco@coderspirit.xyz>
1 parent a72208b commit 9e30c24

File tree

5 files changed

+94
-4
lines changed

5 files changed

+94
-4
lines changed

.eslintrc.cjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module.exports = {
1616
'import',
1717
'prettier',
1818
'react-refresh',
19+
'sonarjs',
20+
'unicorn',
1921
],
2022
extends: [
2123
'eslint:recommended',
@@ -26,10 +28,17 @@ module.exports = {
2628
'plugin:react/recommended',
2729
'plugin:react/jsx-runtime',
2830
'plugin:react-hooks/recommended',
31+
"plugin:sonarjs/recommended",
2932
'plugin:storybook/recommended',
33+
'plugin:unicorn/recommended',
3034
'prettier',
3135
],
3236
rules: {
37+
// Base ESLint rules
38+
'curly': 'error',
39+
'sort-imports': 'error',
40+
41+
// TypeScript-related rules
3342
'@typescript-eslint/consistent-type-exports': 'error',
3443
'@typescript-eslint/consistent-type-imports': 'error',
3544
"@typescript-eslint/explicit-function-return-type": "error",
@@ -40,6 +49,18 @@ module.exports = {
4049
"@typescript-eslint/no-unnecessary-qualifier": "error",
4150
"@typescript-eslint/prefer-readonly": "error",
4251
"@typescript-eslint/prefer-readonly-parameter-types": "error",
52+
"@typescript-eslint/promise-function-async": "error",
53+
"@typescript-eslint/require-array-sort-compare": "error",
54+
"@typescript-eslint/sort-type-constituents": "error",
55+
"@typescript-eslint/switch-exhaustiveness-check": "error",
56+
"no-shadow": "off", // replaced by @typescript-eslint/no-shadow
57+
"@typescript-eslint/no-shadow": "error",
58+
"no-return-await": "off", // replaced by @typescript-eslint/return-await
59+
"@typescript-eslint/return-await": "error",
60+
61+
// Unicorn Rules
62+
'unicorn/filename-case': 'off',
63+
'unicorn/prevent-abbreviations': 'off',
4364
},
4465
settings: {
4566
react: {

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
"eslint-plugin-react": "^7.33.1",
6464
"eslint-plugin-react-hooks": "^4.6.0",
6565
"eslint-plugin-react-refresh": "^0.4.3",
66+
"eslint-plugin-sonarjs": "^0.20.0",
6667
"eslint-plugin-storybook": "^0.6.13",
68+
"eslint-plugin-unicorn": "^48.0.1",
6769
"prettier": "^3.0.1",
6870
"publint": "^0.2.0",
6971
"react": "^18.2.0",

pnpm-lock.yaml

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

src/core.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ const _computeLeftShiftLayout = (
3838
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3939
layout[depth]!.push(x)
4040

41-
const treeWithLayout = {
41+
return {
4242
data: tree.data,
4343
children: tree.children?.map((child: Readonly<TreeChild>) => ({
4444
edgeData: child.edgeData,
4545
node: _computeLeftShiftLayout(child.node, depth + 1, layout),
4646
})),
4747
layout: { plan: { x, y: depth } },
4848
} satisfies TreeWithLayout
49-
50-
return treeWithLayout
5149
}
5250

5351
export const computeLeftShiftLayout: ((tree: Tree) => TreeWithLayout) = _computeLeftShiftLayout

src/tests/core.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'vitest'
1+
import { describe, expect, it } from 'vitest'
22
import { computeLeftShiftLayout } from '../core'
33

44
describe('computeLeftShiftLayout', () => {

0 commit comments

Comments
 (0)