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

Update eslint and config #2737

Merged
merged 8 commits into from
Jul 14, 2017
Merged

Update eslint and config #2737

merged 8 commits into from
Jul 14, 2017

Conversation

jeddy3
Copy link
Member

@jeddy3 jeddy3 commented Jul 13, 2017

Reordering the requires was autofixable. no-useless-escape should of been, but didn’t seem to work. It was worth the manual effort though as the rule caught a couple of typos in tests where \ was being used instead of \n.

@@ -238,7 +238,7 @@ testRule(rule, {

testRule(rule, {
ruleName,
config: [ 20, { ignorePattern: "/https?:\/\/[0-9,a-z]*.*/" } ],
config: [ 20, { ignorePattern: "/https?://[0-9,a-z]*.*/" } ],
Copy link
Member

Choose a reason for hiding this comment

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

My regex tool throws an error for this: ERROR: Unescaped forward slash.

Copy link
Member Author

@jeddy3 jeddy3 Jul 13, 2017

Choose a reason for hiding this comment

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

Keep in mind that this isn't a regex itself, but rather a string of a regex. It might not make any difference though, so you might be right.

Copy link
Member

@ntwb ntwb Jul 13, 2017

Choose a reason for hiding this comment

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

Per the rule docs though this should be a regex though should it not?
https://stylelint.io/user-guide/rules/max-line-length/#ignorepattern-regex

"Ignore any line that matches the given regex pattern, regardless of whether it is comment or not."

I can't remember which rule or rules have the option to use a string or a regex but it doesn't appear that max-line-length is one of the rules that allows a string or regex in the pattern, only a regex based on the rule documentation

Copy link
Member Author

Choose a reason for hiding this comment

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

Per the rule docs though this should be a regex though should it not?

I meant that it's a regular expression within a string e.g. "/regex/", rather than a regular expression itself e.g. /regex/. To be honest, all this regex handling and escaping, especially when they're as strings within JSON configuration objects, is a bit beyond me!

The tests are passing though, so does that mean we're OK? Or should we continue to dig deeper?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Arcanemagus I hope you don't mind me pinging you, but do you have any thoughts on this? You seemed knowledgeable about this subject in the other issue: #2673.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking into how the string is used.

Copy link
Contributor

@Arcanemagus Arcanemagus Jul 13, 2017

Choose a reason for hiding this comment

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

Looks like the string has the beginning and ending / cut off of it and fed into new RegExp here, which means the / within the string do not need to be escaped:
image

So this change is correct as far as I can see 😉.

(Note that the previous string produced the same results, so this isn't changing anything.)

Copy link
Member Author

@jeddy3 jeddy3 Jul 13, 2017

Choose a reason for hiding this comment

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

Awesome thanks! Great to have a second pair of eyes looks this one over :)

Rolling with what we in this PR SGTM.

Copy link
Member

Choose a reason for hiding this comment

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

SGTM ✅ Merge away 💥

@@ -12,7 +12,7 @@ it("hasEmptyLine", () => {
expect(hasEmptyLine("\n \n")).toBeTruthy()
expect(hasEmptyLine("\r\n \r\n")).toBeTruthy()
expect(hasEmptyLine("\n \n \n \n")).toBeTruthy()
expect(hasEmptyLine("\r \n\ r\n\r\n\r\n")).toBeTruthy()
expect(hasEmptyLine("\r \n\n r\n\r\n\r\n")).toBeTruthy()
Copy link
Member

Choose a reason for hiding this comment

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

Nice that it caught these \n's 👌

@@ -26,6 +27,7 @@ if (
) {
parsedOptions = JSON.parse(ruleOptions)
}
/* eslint-disable eqeqeq */
Copy link
Member

Choose a reason for hiding this comment

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

This should be /* eslint-enable eqeqeq */

Copy link
Member

Choose a reason for hiding this comment

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

p.s. This inline comment doesn't show the /* eslint-disable eqeqeq */ a couple of lines up at line 21

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@ntwb
Copy link
Member

ntwb commented Jul 13, 2017

I picked up that one regex issue, going to take a second look, a closer look at a few more regex's

@jeddy3
Copy link
Member Author

jeddy3 commented Jul 13, 2017

I picked up that one regex issue, going to take a second look, a closer look at a few more regex's

Please do! I'm going to be out for the next couple of hours, so feel free to pull down this branch, edit and push back up with any changes.

@jeddy3 jeddy3 merged commit 9112da2 into v8 Jul 14, 2017
@jeddy3 jeddy3 deleted the eslint-config-update branch July 14, 2017 08:17
jeddy3 added a commit that referenced this pull request Jul 14, 2017
* Add stylelint semantic versioning policy

* Fix whitespace and empty lines

* Add changelog entry

* Remove stylelint-config=standard reference

* Tweak major release optional options verbiage

* Update changelog

* Props ESLint

* Fix false negatives with ignore: ["descendant"] in selector-no-type (#2200)

* Update CHANGELOG.md

* Fix handling of shared-line comments (#2262)

* Fix handling of shared-line comments

Introduces a number of utilities and adjusts the following rules:
at-rule-empty-line-before, custom-property-empty-line-before,
declaration-empty-line-before, rule-nested-empty-line-before,
rule-non-nested-empty-line-before

Closes #2237; closes #2239; closes #2240.

* Fixes based on feedback

* Use getPreviousNonSharedLineCommentNode more

* Use more new helpers in comment-empty-line-before

* Add ignore: ["child"] option to selector-no-type (#2217)

* Add ignore: ["child"] option to selector-no-type

* Correct logic for ignore: ["child"] option

* Include line and column in reject tests with multiple type selectors

* Update CHANGELOG.md

* Report every selector resolved selector in selector-max-compound-selectors (#2350)

* Update CHANGELOG.md

* Add new shorthand data (#2354)

* Add new shorthand data

* Add mask shorthand

* Use defined list of properties in shorthand-property-no-redundant-values

* Improve declaration-block-no-shorthand-property-overrides speed a little bit

* Check prefixed properties agains prefixed properties in declaration-block-no-shorthand-property-overrides

* Improve declaration-block-no-redundant-longhand-properties speed a little bit

* Ignore prefixes case in declaration-block-no-shorthand-property-overrides

* Check prefixed properties agains prefixed properties in declaration-block-no-redundant-longhand-properties

* Add `grid-gap` to shorthand-property-no-redundant-values

* Explain properties set for shorthand-property-no-redundant-values

* Revert unnecessary changes

* Add “mask” to declaration-block-no-redundant-longhand-properties readme

* Update CHANGELOG.md

* Update changelog

* Remove deprecated rules (#2422)

* Remove deprecated rules

* Include `rule-empty-line-before` in system tests

* *-empty-line-before rules consider line as empty if it contains whitespace only (#2440)

* Update CHANGELOG.md

* Remove deprecated options (#2433)

* Update CHANGELOG.md

* report-needless-disables now exits with non-zero code (#2341)

* Update CHANGELOG.md

* Remove leftover files (#2442)

* Remove leftover file

* One more

* And one more

* Ignoring improvements (#2464)

* WIP ignoring improvements

* Remove standaloneIgnored property of result

* Add disableDefaultIgnores

* Add documentation tweaks

* Add parseStylelintIgnore tests

* Non-absolutized ignore file paths

* Restire gitignore syntax

* Remove parseStylelintIgnore

* Update CHANGELOG.md

* Check all linear-gradients in a value list (#2496)

Closes #2481

* Update CHANGELOG.md

* Update CHANGELOG.md

* Respect line case for `ignorePattern` (#2683)

Closes #2647

* Update CHANGELOG.md

* Update decls

* Fix remark warning

* Update snapshots

* Add missing message to reject test

* Fix tests for *-empty-line-before rules (#2688)

* Fix tests for *-empty-line-before rules

* Test addition and tweak

* Update to PostCSS@6 (#2561)

* Update to PostCSS@6

* Fix PostCSS@6 closing-brace test (#2689)

* Account for PostCSS@6's support for at-apply

* Remove only

* Fix postcssPlugin tests (#2690)

* Fix defaultSeverity.test.js test

* Fix ignoreDisables test

* Check ownSemiColon

* Fixed: remove hacks related to custom property set.

* Remove deprecated rules (#2693)

Closes #2521

* Update CHANGELOG.md

* Update CHANGELOG.md

* Add VISION.md (#2704)

* Add releases.md (#2705)

* Add releases.md

Closes #2700

* Add dry-release step

* Use HTTPS for links

* Change ignore options for selector-max-type (#2701)

* Fix false negatives with ignore descendant

* Add ignore child

Closes #2699

* Update CHANGELOG.md

* Update README.md to account for VISION.md (#2727)

* Update README.md to account for VISION.md

* Fix lint warnings in CHANGELOG

* Update postcss-less to 1.0 (#2702)

* Update postcss-less to 1.0.2

* Update isStandardSyntaxRule for postcss-less 1.0

* Pass custom postcss stringifier when creating result

* Correct no-extra-semicolons Less test position

* Ignore Less mixins in no-extra-semicolons

* Update postcss-less to 1.1.0

* Correct no-extra-semicolons Less test position again

* Utilize isStandardSyntaxRule when checking for Less rules in no-extra-semicolons

* Case sensitive white/blacklists and ignore* options (#2709)

Closes #2660

* Update CHANGELOG.md

* docs: Add "New Release Issue Template" to releases.md (#2728)

* Exit with non-zero code on postcss warnings (#2713)

* Enhancement: exit with non zero code on postcss warnings.

* Account for parseErrors in stringformatqer

* Guard against no parseErrors

* Update CHANGELOG.md

* Refactor: simplify ignore logic. (#2732)

* Update changelog

* Bump 8.0.0 changes to top

* Correctly place changelog items

* Add introduction

* Add codefence for website

* Use relative path

* Include VISION in package for website

* Add link to VISION doc for website

* Changelog amends

* Update releases.md (#2738)

* Update eslint and config (#2737)

* Order requires

* Use eqeqeq eslint rule

* Update eslint

* Disable no-useless-escape just for this repo

* Enable no-useless-escape rule

* Use tilde

* Fix enable comment

* Add reject test for unescaped regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants