Skip to content

Commit 6b623fd

Browse files
committed
update eslint rules
1 parent d6e9d18 commit 6b623fd

File tree

198 files changed

+2154
-1863
lines changed

Some content is hidden

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

198 files changed

+2154
-1863
lines changed

.eslintrc.js

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

.eslintrc.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"extends": ["prettier"],
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "prettier"],
5+
"parserOptions": {
6+
"ecmaVersion": "latest",
7+
"sourceType": "module",
8+
"ecmaFeatures": {
9+
"jsx": true
10+
}
11+
},
12+
"rules": {
13+
"@typescript-eslint/member-ordering": [
14+
"warn",
15+
{
16+
"default": [
17+
"private-static-field",
18+
"protected-static-field",
19+
"public-static-field",
20+
"private-static-method",
21+
"protected-static-method",
22+
"public-static-method",
23+
"private-instance-field",
24+
"protected-instance-field",
25+
"public-instance-field",
26+
"private-constructor",
27+
"protected-constructor",
28+
"public-constructor",
29+
"private-instance-method",
30+
"protected-instance-method",
31+
"public-instance-method"
32+
]
33+
}
34+
],
35+
"array-bracket-newline": [
36+
"warn",
37+
{
38+
"multiline": true
39+
}
40+
],
41+
"array-bracket-spacing": ["warn", "never"],
42+
"arrow-body-style": ["warn", "as-needed"],
43+
"block-spacing": ["warn", "always"],
44+
"camelcase": [
45+
"off",
46+
{
47+
"properties": "never"
48+
}
49+
],
50+
"comma-dangle": [
51+
"warn",
52+
{
53+
"arrays": "only-multiline",
54+
"objects": "only-multiline",
55+
"imports": "only-multiline",
56+
"exports": "only-multiline",
57+
"functions": "only-multiline"
58+
}
59+
],
60+
"dot-notation": "warn",
61+
"eol-last": ["warn", "always"],
62+
"eqeqeq": ["error", "always"],
63+
"indent": [
64+
"warn",
65+
4,
66+
{
67+
"SwitchCase": 1,
68+
"ignoreComments": true
69+
}
70+
],
71+
"jsx-quotes": ["warn", "prefer-double"],
72+
"linebreak-style": ["error", "unix"],
73+
"no-console": "error",
74+
"no-extra-semi": "error",
75+
"no-multi-spaces": ["warn"],
76+
"no-tabs": ["warn"],
77+
"no-trailing-spaces": ["warn", { "ignoreComments": true }],
78+
"no-unused-expressions": [
79+
"warn",
80+
{
81+
"allowShortCircuit": true
82+
}
83+
],
84+
"prettier/prettier": [
85+
"warn",
86+
{
87+
"usePrettierrc": true
88+
}
89+
],
90+
"quotes": [
91+
"warn",
92+
"single",
93+
{
94+
"avoidEscape": true
95+
}
96+
],
97+
"require-await": "error",
98+
"semi": ["warn", "always"],
99+
"use-isnan": [
100+
"error",
101+
{
102+
"enforceForSwitchCase": true
103+
}
104+
],
105+
"valid-typeof": "warn",
106+
"yoda": ["error", "never"]
107+
}
108+
}

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
uses: actions/setup-node@v3
2020
with:
2121
node-version: '22'
22-
- run: yarn install
22+
- run: yarn install --ignore-scripts
2323
- run: yarn lint
2424
- run: yarn test

.husky/pre-commit

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
bash << EOF
5-
npm run count
6-
git add README.md
7-
EOF
8-
91
npx lint-staged
2+
git update-index --again

.prettierrc.js

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

.prettierrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSameLine": true,
4+
"bracketSpacing": true,
5+
"endOfLine": "lf",
6+
"jsxSingleQuote": false,
7+
"printWidth": 140,
8+
"semi": true,
9+
"singleAttributePerLine": false,
10+
"singleQuote": true,
11+
"tabWidth": 4,
12+
"trailingComma": "all",
13+
"useTabs": false,
14+
"proseWrap": "preserve"
15+
}

6_kyu/Array.diff/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { arrayDiff } from "./index";
1+
import { arrayDiff } from './index';
22

3-
describe("Basic tests", () => {
4-
it("Basic test should work", () => {
3+
describe('Basic tests', () => {
4+
it('Basic test should work', () => {
55
expect(arrayDiff([], [4, 5])).toStrictEqual([]);
66
expect(arrayDiff([3, 4], [3])).toStrictEqual([4]);
77
expect(arrayDiff([1, 8, 2], [])).toStrictEqual([1, 8, 2]);

6_kyu/Bit Counting/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { countBits } from "./index";
1+
import { countBits } from './index';
22

3-
describe("Tests", () => {
4-
it("example", () => {
3+
describe('Tests', () => {
4+
it('example', () => {
55
expect(countBits(1234)).toBe(5);
66
expect(countBits(0)).toBe(0);
77
expect(countBits(4)).toBe(1);

6_kyu/Bit Counting/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export function countBits(n: number): number {
22
const numbers = n
33
.toString(2)
4-
.split("")
5-
.filter((n) => n === "1");
4+
.split('')
5+
.filter((n) => n === '1');
66

77
return numbers.length;
88
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { toCamelCase } from "./index";
1+
import { toCamelCase } from './index';
22

3-
describe("Tests", () => {
4-
it("example", () => {
5-
expect(toCamelCase("")).toBe("");
6-
expect(toCamelCase("the_stealth_warrior")).toBe("theStealthWarrior");
7-
expect(toCamelCase("The-Stealth-Warrior")).toBe("TheStealthWarrior");
8-
expect(toCamelCase("A-B-C")).toBe("ABC");
3+
describe('Tests', () => {
4+
it('example', () => {
5+
expect(toCamelCase('')).toBe('');
6+
expect(toCamelCase('the_stealth_warrior')).toBe('theStealthWarrior');
7+
expect(toCamelCase('The-Stealth-Warrior')).toBe('TheStealthWarrior');
8+
expect(toCamelCase('A-B-C')).toBe('ABC');
99
});
1010
});

0 commit comments

Comments
 (0)