Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Improve prefer-array-literal rule #862

Merged

Conversation

IllusionMH
Copy link
Contributor

@IllusionMH IllusionMH commented May 12, 2019

PR checklist

Overview of change:

  1. Updated tslint test for rule
  2. It is forbidden to call Array only like Array, window.Array, global.Array, and globalThis.Array. Other namespaces are allowed.
  3. Allow calls with single number parameter

Is there anything you'd like reviewers to focus on?

I haven't included self from Web Wrokers to list of restricted parents for property access expression because of var self = this pattern. Should I include self too?

Any suggesting what should trigger error for single parameter if type checker is not available?
I think that allowing everything without type checker (like ESLint does) and expect anything assignable to number if checker available will be good enough.

Code is ready for review, but I still need to add options description to rule meta and update README.md with new option.

@IllusionMH IllusionMH changed the title Improve prefer array literal rule [WIP] Improve prefer-array-literal rule May 13, 2019
@IllusionMH IllusionMH force-pushed the improve-prefer-array-literal-rule branch from c8ab85f to 8bd02f7 Compare May 14, 2019 00:10
@IllusionMH IllusionMH changed the title [WIP] Improve prefer-array-literal rule Improve prefer-array-literal rule May 14, 2019
Copy link

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality LGTM! Just some comments around the options.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/preferArrayLiteralRule.ts Outdated Show resolved Hide resolved
src/preferArrayLiteralRule.ts Outdated Show resolved Hide resolved
src/preferArrayLiteralRule.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg added the PR: Waiting for Author Changes have been requested that the pull request author should address. label May 15, 2019
@IllusionMH IllusionMH added PR: Waiting for Reviewer A repository maintainer should take a look at the pull request soon! and removed PR: Waiting for Author Changes have been requested that the pull request author should address. labels May 16, 2019
@IllusionMH IllusionMH force-pushed the improve-prefer-array-literal-rule branch from 762f7dc to cb4d3c7 Compare May 17, 2019 01:08
Copy link

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@IllusionMH
Copy link
Contributor Author

Thank you for feedback and review!

@IllusionMH IllusionMH merged commit f85d5f6 into microsoft:master May 17, 2019
@IllusionMH IllusionMH deleted the improve-prefer-array-literal-rule branch May 17, 2019 23:47
@IllusionMH IllusionMH added this to the 6.2.0-beta milestone May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR: Waiting for Reviewer A repository maintainer should take a look at the pull request soon!
Projects
None yet
2 participants