Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate style lint rules to ESLint Stylistic #137

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,36 @@
"airbnb-typescript",
"plugin:react/recommended",
// "plugin:@typescript-eslint/recommended-type-checked",
"plugin:import/typescript"
"plugin:import/typescript",
"plugin:@stylistic/disable-legacy",
"plugin:jest-formatting/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@stylistic",
"react",
"@typescript-eslint",
"import-newlines",
"unused-imports",
"eslint-plugin-local-rules"
"eslint-plugin-local-rules",
"jest-formatting"
],
"rules": {
"no-console":"off",
"max-len": ["error", {"code": 115}],
"lines-between-class-members": ["error", "always", {"exceptAfterSingleLine": true}],
"@stylistic/max-len": [
"error",
{
"code": 115,
"comments": 200,
"ignoreRegExpLiterals": true
}
],
"@stylistic/no-extra-semi": "error",
"@stylistic/lines-between-class-members": ["error", "always", {"exceptAfterSingleLine": true}],
"import/extensions": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-useless-constructor": "off",
Expand All @@ -44,11 +56,11 @@
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
"max-classes-per-file": ["off"],
"curly": ["error", "multi-line"],
"semi": ["error", "always"],
"comma-dangle": ["error", "always-multiline"],
"function-call-argument-newline": ["error", "consistent"],
"function-paren-newline": ["error", "multiline-arguments"],
"object-curly-newline": [
"@stylistic/semi": ["error", "always"],
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-paren-newline": ["error", "multiline-arguments"],
"@stylistic/object-curly-newline": [
"error",
{
"ObjectExpression": {
Expand All @@ -61,7 +73,7 @@
}
}
],
"no-whitespace-before-property": "error",
"@stylistic/no-whitespace-before-property": "error",
"import-newlines/enforce": [
"error",
{
Expand All @@ -72,13 +84,13 @@
],
"react/display-name": "off",
"no-plusplus": "off",
"no-trailing-spaces": "error",
"@stylistic/no-trailing-spaces": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error", {"allow": ["Graph"]}],
"react/button-has-type": "off",
"react/jsx-one-expression-per-line": ["off"],
"arrow-body-style": ["off"],
"@typescript-eslint/quotes": ["error", "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
"@stylistic/quotes": ["error", "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/no-explicit-any": "off",
"import/prefer-default-export": "off",
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test": "test"
},
"dependencies": {
"@stylistic/eslint-plugin": "^1.7.0",
"hoist-non-react-statics": "3.x.x",
"jest-cli": "^29.5.0",
"reflect-metadata": "~0.1.13"
Expand All @@ -40,16 +41,18 @@
"@types/react-dom": "18.2.x",
"@typescript-eslint/eslint-plugin": "6.6.x",
"@typescript-eslint/parser": "6.6.x",
"@typescript-eslint/types": "6.6.x",
"@typescript-eslint/rule-tester": "6.6.x",
"@typescript-eslint/types": "6.6.x",
"@typescript-eslint/typescript-estree": "6.6.x",
"@typescript-eslint/utils": "6.6.x",
"babel-eslint": "^10.1.0",
"babel-plugin-parameter-decorator": "1.x.x",
"class-validator": "^0.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb-typescript": "17.x.x",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-import-newlines": "^1.1.5",
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-local-rules": "^1.3.2",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
Expand All @@ -63,8 +66,7 @@
"react": "18.2.x",
"react-dom": "18.2.x",
"setimmediate": "^1.0.5",
"typescript": "^4.5.4",
"eslint-config-airbnb-typescript": "17.x.x"
"typescript": "^4.5.4"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/decorators/Memoize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Uut {

describe('Memoized', () => {
let uut: Uut;

beforeEach(() => {
uut = new Uut();
});
Expand Down
1 change: 0 additions & 1 deletion src/graph/PropertyRetriever.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('PropertyRetriever', () => {
it('throws on circular dependencies', () => {
const uut1 = new PropertyRetriever(new CircularDependencyGraph2());
expect(() => uut1.retrieve('dep1')).toThrowError(
// eslint-disable-next-line max-len
/Could not resolve dep1 from CircularDependencyGraph2\d because of a circular dependency: dep1 -> dep2 -> dep3 -> dep1/,
);
});
Expand Down
5 changes: 1 addition & 4 deletions test/acceptance/obtain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ describe('obtain', () => {
it('Should throw circular dependency error when encountering circular dependencies', () => {
expect(
() => Obsidian.obtain(CircularDependencyGraph).aString(),
).toThrowError(
// eslint-disable-next-line max-len
/Could not resolve aString from CircularDependencyGraph\d because of a circular dependency: aString -> aString$/,
);
).toThrowError(/Could not resolve aString from CircularDependencyGraph\d because of a circular dependency: aString -> aString$/);
});

it('Should not throw circular dependency error resolving valid dependencies', () => {
Expand Down
142 changes: 138 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,55 @@
dependencies:
"@sinonjs/commons" "^3.0.0"

"@stylistic/[email protected]", "@stylistic/eslint-plugin-js@^1.7.0":
version "1.7.0"
resolved "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.7.0.tgz#7453e3c340284254d33ca25a1a3f234337155087"
integrity sha512-PN6On/+or63FGnhhMKSQfYcWutRlzOiYlVdLM6yN7lquoBTqUJHYnl4TA4MHwiAt46X5gRxDr1+xPZ1lOLcL+Q==
dependencies:
"@types/eslint" "^8.56.2"
acorn "^8.11.3"
escape-string-regexp "^4.0.0"
eslint-visitor-keys "^3.4.3"
espree "^9.6.1"

"@stylistic/[email protected]":
version "1.7.0"
resolved "https://registry.npmjs.org/@stylistic/eslint-plugin-jsx/-/eslint-plugin-jsx-1.7.0.tgz#6f85a4ee68af0ad0c94dad000631eea06fc4103f"
integrity sha512-BACdBwXakQvjYIST5N2WWhRbvhRsIxa/F59BiZol+0IH4FSmDXhie7v/yaxDIIA9CbfElzOmIA5nWNYTVXcnwQ==
dependencies:
"@stylistic/eslint-plugin-js" "^1.7.0"
"@types/eslint" "^8.56.2"
estraverse "^5.3.0"
picomatch "^4.0.1"

"@stylistic/[email protected]":
version "1.7.0"
resolved "https://registry.npmjs.org/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.7.0.tgz#2dc56fe9b4e4bfa48e011abe41eb1cb692ddb557"
integrity sha512-AabDw8sXsc70Ydx3qnbeTlRHZnIwY6UKEenBPURPhY3bfYWX+/pDpZH40HkOu94v8D0DUrocPkeeEUxl4e0JDg==
dependencies:
"@types/eslint" "^8.56.2"
"@typescript-eslint/utils" "^6.21.0"

"@stylistic/[email protected]":
version "1.7.0"
resolved "https://registry.npmjs.org/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-1.7.0.tgz#b3bce3235a1cdf27448910ebc049b8bd4ba7ee43"
integrity sha512-QsHv98mmW1xaucVYQTyLDgEpybPJ/6jPPxVBrIchntWWwj74xCWKUiw79hu+TpYj/Pbhd9rkqJYLNq3pQGYuyA==
dependencies:
"@stylistic/eslint-plugin-js" "1.7.0"
"@types/eslint" "^8.56.2"
"@typescript-eslint/utils" "^6.21.0"

"@stylistic/eslint-plugin@^1.7.0":
version "1.7.0"
resolved "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-1.7.0.tgz#5eb773af683f82665652dae1977261383e9993ba"
integrity sha512-ThMUjGIi/jeWYNvOdjZkoLw1EOVs0tEuKXDgWvTn8uWaEz55HuPlajKxjKLpv19C+qRDbKczJfzUODfCdME53A==
dependencies:
"@stylistic/eslint-plugin-js" "1.7.0"
"@stylistic/eslint-plugin-jsx" "1.7.0"
"@stylistic/eslint-plugin-plus" "1.7.0"
"@stylistic/eslint-plugin-ts" "1.7.0"
"@types/eslint" "^8.56.2"

"@testing-library/dom@^9.0.0":
version "9.3.1"
resolved "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.1.tgz"
Expand Down Expand Up @@ -1571,6 +1620,14 @@
"@types/estree" "*"
"@types/json-schema" "*"

"@types/eslint@^8.56.2":
version "8.56.6"
resolved "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.6.tgz#d5dc16cac025d313ee101108ba5714ea10eb3ed0"
integrity sha512-ymwc+qb1XkjT/gfoQwxIeHZ6ixH23A+tCT2ADSA/DPVKzAjwYkTXBMCQ/f6fe4wEa85Lhp26VPeUxI7wMhAi7A==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"

"@types/estree@*":
version "1.0.5"
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
Expand Down Expand Up @@ -1744,6 +1801,14 @@
lodash.merge "4.6.2"
semver "^7.5.4"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1"
integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==
dependencies:
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/visitor-keys" "6.21.0"

"@typescript-eslint/[email protected]":
version "6.6.0"
resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz#57105d4419d6de971f7d2c30a2ff4ac40003f61a"
Expand All @@ -1762,11 +1827,30 @@
debug "^4.3.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d"
integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==

"@typescript-eslint/[email protected]", "@typescript-eslint/[email protected]":
version "6.6.0"
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz#95e7ea650a2b28bc5af5ea8907114a48f54618c2"
integrity sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46"
integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==
dependencies:
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/visitor-keys" "6.21.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
minimatch "9.0.3"
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]", "@typescript-eslint/[email protected]":
version "6.6.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz#373c420d2e12c28220f4a83352280a04823a91b7"
Expand All @@ -1793,6 +1877,27 @@
"@typescript-eslint/typescript-estree" "6.6.0"
semver "^7.5.4"

"@typescript-eslint/utils@^6.21.0":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134"
integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
"@types/json-schema" "^7.0.12"
"@types/semver" "^7.5.0"
"@typescript-eslint/scope-manager" "6.21.0"
"@typescript-eslint/types" "6.21.0"
"@typescript-eslint/typescript-estree" "6.21.0"
semver "^7.5.4"

"@typescript-eslint/[email protected]":
version "6.21.0"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47"
integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==
dependencies:
"@typescript-eslint/types" "6.21.0"
eslint-visitor-keys "^3.4.1"

"@typescript-eslint/[email protected]":
version "6.6.0"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz#1109088b4346c8b2446f3845db526374d9a3bafc"
Expand Down Expand Up @@ -1834,6 +1939,11 @@ acorn@^8.1.0, acorn@^8.8.1, acorn@^8.9.0:
resolved "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz"
integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==

acorn@^8.11.3:
version "8.11.3"
resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==

agent-base@6:
version "6.0.2"
resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz"
Expand Down Expand Up @@ -2118,6 +2228,13 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"

brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"

braces@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz"
Expand Down Expand Up @@ -2671,6 +2788,11 @@ eslint-plugin-import@^2.25.2:
semver "^6.3.1"
tsconfig-paths "^3.14.2"

eslint-plugin-jest-formatting@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/eslint-plugin-jest-formatting/-/eslint-plugin-jest-formatting-3.1.0.tgz#b26dd5a40f432b642dcc880021a771bb1c93dcd2"
integrity sha512-XyysraZ1JSgGbLSDxjj5HzKKh0glgWf+7CkqxbTqb7zEhW7X2WHo5SBQ8cGhnszKN+2Lj3/oevBlHNbHezoc/A==

eslint-plugin-local-rules@^1.3.2:
version "1.3.2"
resolved "https://registry.npmjs.org/eslint-plugin-local-rules/-/eslint-plugin-local-rules-1.3.2.tgz#b9c9522915faeb9e430309fb909fc1dbcd7aedb3"
Expand Down Expand Up @@ -2703,10 +2825,10 @@ eslint-plugin-react@^7.26.1:
semver "^6.3.1"
string.prototype.matchall "^4.0.8"

eslint-plugin-unused-imports@2.x.x:
version "2.0.0"
resolved "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz"
integrity sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==
eslint-plugin-unused-imports@3.1.x:
version "3.1.0"
resolved "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz#db015b569d3774e17a482388c95c17bd303bc602"
integrity sha512-9l1YFCzXKkw1qtAru1RWUtG2EVDZY0a0eChKXcL+EZ5jitG7qxdctu4RnvhOJHv4xfmUf7h+JJPINlVpGhZMrw==
dependencies:
eslint-rule-composer "^0.3.0"

Expand Down Expand Up @@ -4145,6 +4267,13 @@ mimic-fn@^2.1.0:
resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==

[email protected]:
version "9.0.3"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
dependencies:
brace-expansion "^2.0.1"

minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
version "3.1.2"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz"
Expand Down Expand Up @@ -4390,6 +4519,11 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1:
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

picomatch@^4.0.1:
version "4.0.2"
resolved "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==

pirates@^4.0.4:
version "4.0.6"
resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz"
Expand Down
Loading