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

infra: configure lint rule array-type #1793

Merged
merged 6 commits into from Feb 1, 2023
Merged

infra: configure lint rule array-type #1793

merged 6 commits into from Feb 1, 2023

Conversation

Shinigami92
Copy link
Member

This configures the lint rule https://typescript-eslint.io/rules/array-type/

We could decide if we want to configure it with:

{ default: "array-simple" } or { default: "array-simple", readonly: "generic" }

The difference would be:

number[]
Array<Foo & Bar>
readonly number[]
ReadonlyArray<Foo & Bar>

vs

number[]
Array<Foo & Bar>
ReadonlyArray<number> // <- this is different
ReadonlyArray<Foo & Bar>

@Shinigami92 Shinigami92 added the c: infra Changes to our infrastructure or project setup label Jan 29, 2023
@Shinigami92 Shinigami92 requested a review from a team as a code owner January 29, 2023 21:40
@Shinigami92 Shinigami92 self-assigned this Jan 29, 2023
@codecov
Copy link

codecov bot commented Jan 29, 2023

Codecov Report

Merging #1793 (4b56c15) into next (be77179) will not change coverage.
The diff coverage is 89.47%.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1793   +/-   ##
=======================================
  Coverage   99.63%   99.63%           
=======================================
  Files        2346     2346           
  Lines      235000   235002    +2     
  Branches     1133     1133           
=======================================
+ Hits       234145   234147    +2     
  Misses        833      833           
  Partials       22       22           
Impacted Files Coverage Δ
src/definitions/science.ts 0.00% <0.00%> (ø)
src/modules/helpers/index.ts 99.20% <100.00%> (ø)
src/modules/internet/index.ts 100.00% <100.00%> (ø)
src/modules/random/index.ts 99.12% <100.00%> (ø)
src/modules/string/index.ts 100.00% <100.00%> (ø)

@ST-DDT ST-DDT added the p: 1-normal Nothing urgent label Jan 29, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Jan 29, 2023

The difference would be:

Please add a hint what the new one is^^


I generally agree with adding this rule, I just consider ReadonlyArray<number> to be easier to read.

IMO the readonly refers to the array and thus should be "close" to the array.
In readonly number[] you have the array element type mixed in between.

Is there a reason for the shuffled declaration?

@Shinigami92
Copy link
Member Author

Please add a hint what the new one is ^^

both are new (?!)
we could decide for one of these both option configurations

@Shinigami92
Copy link
Member Author

I generally agree with adding this rule, I just consider ReadonlyArray to be easier to read.

IMO the readonly refers to the array and thus should be "close" to the array.
In readonly number[] you have the array element type mixed in between.

Is there a reason for the shuffled declaration?

This is exactly what I also thought!
Okay I will switch to the second

@ST-DDT ST-DDT added the s: accepted Accepted feature / Confirmed bug label Jan 29, 2023
@Shinigami92 Shinigami92 merged commit 5b705d4 into next Feb 1, 2023
@Shinigami92 Shinigami92 deleted the array-type branch February 1, 2023 13:04
matthewmayer pushed a commit to matthewmayer/faker that referenced this pull request Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: infra Changes to our infrastructure or project setup p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants