-
-
Notifications
You must be signed in to change notification settings - Fork 950
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
chore: add eslint unicorn #2417
Conversation
be40894
to
1c2d022
Compare
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
sourceType: 'module', | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
}, | ||
plugins: ['@typescript-eslint', 'prettier', 'deprecation'], | ||
plugins: ['@typescript-eslint', 'prettier', 'deprecation', 'unicorn'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional/already covered by the extends config.
'error', | ||
{ | ||
allowList: { | ||
args: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why args but not arg?
test/modules/helpers.spec.ts
Outdated
@@ -461,7 +461,7 @@ describe('helpers', () => { | |||
const input = Array.from({ length: 2 }, (_, i) => i); | |||
const occurrences = Array.from({ length: 2 }, () => 0); | |||
|
|||
for (let i = 0; i < 1000; i++) { | |||
for (let index = 0; index < 1000; index++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isnt the index it is a counter.
allowList: { | ||
args: true, | ||
fn: true, | ||
obj: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why obj, but not str/num?
1c2d022
to
b9fa313
Compare
@@ -44,8 +44,8 @@ describe('color', () => { | |||
|
|||
describe(`cssSupportedFunction()`, () => { | |||
it('should return random css supported color function from css functions array', () => { | |||
const func = faker.color.cssSupportedFunction(); | |||
expect(Object.values(CssFunction)).toContain(func); | |||
const supportedFunction = faker.color.cssSupportedFunction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name it actual same as in our other tests?
@@ -358,11 +358,11 @@ describe('date', () => { | |||
expect(dates.length).lessThanOrEqual(5); | |||
|
|||
expect(dates[0]).greaterThan(from); | |||
for (let i = 1; i < dates.length; i++) { | |||
expect(dates[i]).greaterThan(dates[i - 1]); | |||
for (let index = 1; index < dates.length; index++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnessarily verbose.
Note to self. Check all the regexes again. |
@ST-DDT I highly suggest you start reviewing this when I'm actually done with it |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #2417 +/- ##
==========================================
- Coverage 99.60% 99.60% -0.01%
==========================================
Files 2802 2802
Lines 252486 252544 +58
Branches 1103 1101 -2
==========================================
+ Hits 251499 251553 +54
- Misses 960 964 +4
Partials 27 27
|
const occurrences = Array.from({ length: 10 }, () => 0); | ||
|
||
for (let i = 0; i < 1000; i++) { | ||
for (let index = 0; index < 1000; index++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isnt an index.
@@ -485,7 +485,7 @@ describe('image', () => { | |||
|
|||
expect(imageUrl).toBeTypeOf('string'); | |||
expect(imageUrl).toMatch( | |||
/^https\:\/\/via\.placeholder\.com\/\d+x\d+\/[0-9a-fA-F]{6}\/[0-9a-fA-F]{6}\.[a-z]{3,4}\?text=.+$/ | |||
/^ht{2}ps:\/{2}via\.placeholder\.com\/\d+x\d+(?:\/[\dA-Fa-f]{6}){2}\.[a-z]{3,4}\?text=.+$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. ht{2}ps:\/{2}
🙅
@@ -297,7 +297,7 @@ describe('internet', () => { | |||
const [prefix, suffix] = email.split('@'); | |||
|
|||
expect(prefix).toMatch( | |||
/^Mike((\d{1,2})|([.!#$%&'*+-/=?^_`{|}~]Smith\d{1,2})|([.!#$%&'*+-/=?^_`{|}~]Smith))/ | |||
/^Mike((\d{1,2})|([!#$%&'*+-/=?^_`{|}~]Smith\d{1,2})|([!#$%&'*+-/=?^_`{|}~]Smith))/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Where did the dot go?
@@ -142,7 +142,7 @@ class TestGenerator< | |||
repetitions: number = 1 | |||
): void { | |||
this.setup(); | |||
for (let i = 0; i < repetitions; i++) { | |||
for (let index = 0; index < repetitions; index++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isnt an index.
I'm not sure I want to review 800 changes in one PR. Correction: The current number of addressed (types of) issues already exceeds what I'm willing to review in a single PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is not reviewable due to size/different kind of changes.
57d0a9e
to
b27a254
Compare
b27a254
to
456698f
Compare
As @ST-DDT already pointed out, I need to split this into several PRs, to reduce the amount of changed files in the same PR. This PR now reflects the approximate change when everything is merged individually. While working on this PR, I at least learned some stuff I can reuse to work on the individual PRs. |
I switched from |
This has been superseded by #2418 and individual PRs per rule. Since Shinigami92 is no longer actively working on this. I will close this because of the merge conflicts. |
Based on #2284 (comment)
This PR will make @fisker really happy ❤️