Skip to content

refactor(schematics): cleanup attribute selector rules #12507

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

Conversation

devversion
Copy link
Member

@devversion devversion commented Aug 3, 2018

  • Cleans up the attribute-selector rules by avoiding duplicate code, too much indentation and nesting. Also moves all rules tied to the attributeSelectors data into a sub directory.

  • Renames the findAll method to findAllSubstringIndices because just having findAll is very ambiguous.

  • Removes the unused extra-stylesheets file.


Note: Ignore the changes related to the findAllSubstringIndices in the other rules. Those will be cleaned-up and moved into a subdirectory in follow-up PRs. This also makes it easier to differentiate between v6 and v7 data at some point.

@devversion devversion added pr: merge safe target: major This PR is targeted for the next major release labels Aug 3, 2018
@devversion devversion requested a review from amcdnl as a code owner August 3, 2018 15:36
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 3, 2018
@devversion devversion force-pushed the refactor/schematics-cleanup-attribute-selectors branch from 0b34535 to 7ba1c5a Compare August 3, 2018 15:43
import * as ts from 'typescript';

/**
* Rule that walks through every string literal that i
Copy link
Member

Choose a reason for hiding this comment

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

Truncated description?

@@ -0,0 +1,54 @@
/**
Copy link
Member

Choose a reason for hiding this comment

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

Probably in another PR, but we should also make these filenames consistent with the rest of the project (dashes instead of camelCase)

Copy link
Member Author

Choose a reason for hiding this comment

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

That does unfortunately not work because TSLint expects the files to the be camel-cased in order to load them.

/** Method that can be used to replace all search occurrences in a string. */
export function findAll(str: string, search: string): number[] {
/** Finds all occurrences of the given search string in an input string and returns the offsets. */
export function findAllSearchOccurrences(input: string, search: string): number[] {
Copy link
Member

Choose a reason for hiding this comment

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

I would call this findAllSubstringIndices

@devversion devversion force-pushed the refactor/schematics-cleanup-attribute-selectors branch from 7ba1c5a to f484081 Compare August 8, 2018 14:32
@devversion
Copy link
Member Author

@jelbourn Addressed your feedback. Please have another look.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Aug 8, 2018
@ngbot
Copy link

ngbot bot commented Aug 8, 2018

I see that you just added the pr: merge ready label, but the following checks are still failing:
    failure status "continuous-integration/travis-ci/pr" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@josephperrott josephperrott added pr: needs rebase and removed action: merge The PR is ready for merge by the caretaker labels Aug 9, 2018
@ngbot
Copy link

ngbot bot commented Aug 9, 2018

Hi @devversion! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

* Cleans up the `attribute-selector` rules by avoiding duplicate code and making the code generally more readable. Also moves all rules tied to the `attributeSelectors` data into a sub directory.
* Renames the `findAll` method to `findAllSubstringIndices` because just having `findAll` is very ambiguous.
* Removes the unused `extra-stylesheets` file.
@devversion devversion force-pushed the refactor/schematics-cleanup-attribute-selectors branch from f484081 to e82d3a3 Compare August 9, 2018 20:26
@devversion devversion added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Aug 9, 2018
@devversion
Copy link
Member Author

@josephperrott Rebased.

@josephperrott josephperrott merged commit 52cb1cb into angular:master Aug 9, 2018
@devversion devversion deleted the refactor/schematics-cleanup-attribute-selectors branch August 9, 2018 21:17
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants