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

chore(deps): update dependency jscs to v3 (master) #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

appcues-wss[bot]
Copy link

@appcues-wss appcues-wss bot commented Feb 18, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
jscs (source) ^2.7.0 -> ^3.0.0 age adoption passing confidence

By merging this PR, the below vulnerabilities will be automatically resolved:

Severity CVSS Score CVE
High High 8.8 CVE-2022-46175
High High 7.5 CVE-2016-10540

Release Notes

jscs-dev/node-jscs (jscs)

v3.0.0

Compare Source

Hell yeah! 3.0 is here. First and foremost we rewrote every... single... rule. We fixed a plentiful amount of bugs (most of which were found during refactoring those rules using CST). This provides us the opportunity to include autofix for complicated rules like the brand new disallowUnusedVariables rule (see below).

Breaking Changes

If you aren't a plugin writer or support build extensions (like grunt or gulp), etc you don't have to worry about anything.

We didn't rename/remove any rules. All you should have to do to update is just bump the jscs version in your package version to 3.0.0 and be done with it.

Configuration

These following config options have been replaced in 3.0:

  • --esnext (-e) // enabled by default
  • --esprima (-s) and --esprimaOptions // babylon is the underlying CST parser
  • --verbose // also enabled by default to show rule name when there is an error

One thing to notice though: the yandex preset was removed. Since Yandex doesn't have official code style (don't look at the https://github.com/ymaps/codestyle), we were requested to remove it

One drawback from all these changes is that JSCS might be a little, just a little slower, so if you find any issues related to that - don't hesitate to drop us a line, or just drop us a line we are all friendly :).

New rules

Since this release is about rewrite of internal design, we adding only four new rules (all of them were added by our contributors!).

disallowUnusedVariables by Brian Schemp

That rule useful when you have var x = <whatever> and you don't export that x and don't use it. This rule will highlight that and remove it if you want.

disallowSpacesInsideImportedObjectBraces and requireSpacesInsideImportedObjectBraces by Maks Sadowsky

When you need or don't need additional parentheses -

import /*–>*/{foo, bar}/*<–*/ from 'foo-bar';
requireUseStrict Erik Vold

Short and cool - ask you to use "use strict" pragma on top of the file if you so desire.

requireImportAlphabetized by Ray Hammond

Keeps your imports alphabetized, pretty handy way to keep your dependency in tidy state.

Presets
  • Preset: allow URLs inside comments for airbnb (andreyvolokitin)
  • Preset: add requireSpaceBeforeObjectValues rule to airbnb preset (Oleg Gaidarenko)
  • Preset: add requireSpacesInsideImportedObjectBraces to airbnb (Maks Sadowsky)
  • Preset: Add 'requireSpaceBetweenArguments' to google preset (Jon Merrifield)
Internal

There are a lot of internal changes but we like to keep this changelog short and tidy. We will continue to update this shortly.

v2.11.0

Compare Source

Spring release! Yeah, yeah, technically spring only comes in middle of the March (you nerds, you), but we're coming to you a bit earlier!

Anyways, there are three new rules, a couple of changes for the airbnb preset and important fixes for disallowSpacesInsideTemplateStringPlaceholders and validateQuoteMarks (for all you ES7 lovers).

New Rules
requireSpaceBeforeDestructuredValues by Maks Sadowsky

Enforces colon spacing after destructuring assignment i.e. requireSpaceBeforeObjectValues but for destructuring.

// good
const { String: EmberString } = Ember;

// bad
const { String:EmberString } = Ember;
disallowArrayDestructuringReturn by Maks Sadowsky

Enforces the 5:3 verse of airbnb code style, which prohibits use of array destructuring for thy CallExpressions.

// God is on your side
const { left, right } = processInput(input);

// Devil is on your shoulder!
const [left, __, top] = processInput(input);
requireNewlineBeforeSingleStatementsInIf by Brian Schemp

Enforces using newlines in your parenthesesless code.

// Cool stairs brah
if (x)
   doX();
else
   doY();

// Just how could you have "X" and "Y"'s on the same line?!
if (x) doX();
else doY();
Presets
  • Preset: ease up on requireCamelCaseOrUpperCaseIdentifiers in airbnb (Oleg Gaidarenko)
  • Preset: add disallowArrayDestructuringReturn to airbnb preset (Maks Sadowsky)
Bug fixes
  • disallowSpacesInsideTemplateStringPlaceholders: check template literal (ikokostya)
  • validateQuoteMarks: do not throw on es7 decorators (Oleg Gaidarenko)

Other commits (as always) are omitted, since they're all about internal stuff and we care about your viewing pleasure.

v2.10.1

Compare Source

Bug fixes
  • Regression in requireSpaceBeforeKeywords #​2135

v2.10.0

Compare Source

Happy Presidents Day!

In this release, it's just some additional rules to update to the airbnb preset, new rules, and fixes.

Preset Changes
  • Add maximumLineLength to the airbnb preset (reference) (Oleg Gaidarenko)
  • Add disallowSpacesInsideTemplateStringPlaceholders to the airbnb preset (not explicit but used in examples) (Oleg Gaidarenko)
  • Add disallowNewlineBeforeBlockStatements rule to the mdcs preset (reference) (Mauricio Massaia)
New Rules
disallowSpacesInsideTemplateStringPlaceholders

(ikokostya)

Disallows spaces before and after curly brace inside template string placeholders.

// usage in config
"disallowSpacesInsideTemplateStringPlaceholders": true
// Valid
`Hello ${name}!`
// Invalid
`Hello ${ name}!`
`Hello ${name }!`
`Hello ${ name }!`
requireImportsAlphabetized (Ray Hammond)

Requires imports to be alphabetized

// usage in config
"requireImportAlphabetized": true
// Valid
import a from 'a';
import c from 'c';
import z from 'z';
// Invalid
import a from 'a';
import z from 'z';
import c from 'c';
Rule Updates
  • requireSpaceBeforeKeywords: add a allExcept option for filtering out default keywords (gpiress)
    • This allows you do specify exceptions to the all keywords instead of creating an array of whitelisted keywords when you only want to blacklist a few.
Bug fixes
  • requireNumericLiterals: miss if first argument is an Identifier (Robert Jackson)
  • disallowSpacesInsideTemplateStringPlaceholders: skip the edge case (Oleg Gaidarenko)
  • requirePaddingNewLinesBeforeExport: exclude if only statement in block (Brian Schemp)
  • maximumLineLength: some nodes might contain null values (Oleg Gaidarenko)
Docs
  • Correct date in the changelog (Oleg Gaidarenko)
  • Various rule corrections (Christopher Cook)

v2.9.0

Compare Source

Changed the changelog date format to be YYYY-MM-DD.

Whoo a release during this blizzard! Hopefully, this will be our last release before we start pushing out pre-release versions of 3.0. (If necessary, we can push bug fixes to 2.x)

The plan:

  • Push the 2.9.0 release
  • Create a 2.x branch off of master
  • Switch master to be the 3.0 branch
  • Merge in 2.x changes + cleanup stuff for a 3.0 alpha release.
  • Do what we can in our 3.0 milestone. We would really appreciate any help!
    • Especially for deprecating rules/options, rule merging, renames/inconsistencies that we don't catch.
New Rules
requireCapitalizedConstructorsNew (Alexander O'Mara)
// Description: Requires capitalized constructors to to use the `new` keyword

// Usage
"requireCapitalizedConstructors": {
  "allExcept": ["somethingNative"]
}

// Valid
var x = new Y();
var x = new somethingNative(); // exception

// Invalid
var x = Y();
Rule Updates
// can turn
var a = [0,
1,
2];

// into
var a = [
0,
1,
2
];

This was @​joerideg's first PR, so congrats and hope to see more contributions (not necessarily here)!

I think we would need a seperate rule to both check/fix alignment properly.

class A {
  prop; // will add a semicolon here
  prop2 = 1; // and here
}
  • requireCamelCaseOrUpperCaseIdentifiers: add extra options allowedPrefixes, allowedSuffixes, allExcept

    • This lets you specify a permitted array of String, RegExp, or ESTree RegExpLiteral values

For options: { allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }

// Extra valid options
var camelCase_dCel = 5;
var _camelCase_MHz = 6;
// Invalid
var camelCase_cCel = 4;
var CamelCase_THz = 5;
// Valid for requireNewlineBeforeBlockStatements
switch (a)
{
  case 1: break;
}

// Valid for disallowNewlineBeforeBlockStatements
switch (a) {
  case 1: break;
}
Presets
  • airbnb: Enforce rule 25.1 (Joe Bartlett)
    • This adds requireDollarBeforejQueryAssignment
  • airbnb: Enforce rule 7.11 (Joe Bartlett)
    • This fixes up function spacing issues (autofixable)
  • google: Enforce naming rules
    • This adds "requireCamelCaseOrUpperCaseIdentifiers": { "allowedPrefixes": ["opt_"], "allExcept": ["var_args"] }
Bug fixes
Misc

v2.8.0

Compare Source

Happy new year! Small changes this time, small, but important fixes which still warrants the minor bump.

Aside from bug fixes, this update includes improvement for the airbnb preset and allExcept option for the disallowNewlineBeforeBlockStatements


  • If you want to rebase/retry this PR, check this box

@appcues-wss appcues-wss bot added the security fix Security fix generated by WhiteSource label Feb 18, 2023
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) Update dependency jscs to v3 (master) - autoclosed Mar 27, 2023
@appcues-wss appcues-wss bot closed this Mar 27, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch March 27, 2023 08:39
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) - autoclosed Update dependency jscs to v3 (master) Mar 31, 2023
@appcues-wss appcues-wss bot reopened this Mar 31, 2023
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch March 31, 2023 12:25
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) Update dependency jscs to v3 (master) - autoclosed May 8, 2023
@appcues-wss appcues-wss bot closed this May 8, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch May 8, 2023 11:49
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) - autoclosed Update dependency jscs to v3 (master) May 8, 2023
@appcues-wss appcues-wss bot reopened this May 8, 2023
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch May 8, 2023 16:52
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) Update dependency jscs to v3 (master) - autoclosed Jun 14, 2023
@appcues-wss appcues-wss bot closed this Jun 14, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch June 14, 2023 20:59
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) - autoclosed Update dependency jscs to v3 (master) Jun 15, 2023
@appcues-wss appcues-wss bot reopened this Jun 15, 2023
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch June 15, 2023 22:18
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) Update dependency jscs to v3 (master) - autoclosed Jun 16, 2023
@appcues-wss appcues-wss bot closed this Jun 16, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch June 16, 2023 14:31
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) - autoclosed Update dependency jscs to v3 (master) Jun 19, 2023
@appcues-wss appcues-wss bot reopened this Jun 19, 2023
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch June 19, 2023 06:53
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) Update dependency jscs to v3 (master) - autoclosed Aug 13, 2023
@appcues-wss appcues-wss bot closed this Aug 13, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch August 13, 2023 19:52
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) - autoclosed Update dependency jscs to v3 (master) Aug 14, 2023
@appcues-wss appcues-wss bot reopened this Aug 14, 2023
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch August 14, 2023 17:00
@appcues-wss appcues-wss bot changed the title Update dependency jscs to v3 (master) chore(deps): update dependency jscs to v3 (master) Oct 30, 2023
@appcues-wss appcues-wss bot changed the title chore(deps): update dependency jscs to v3 (master) chore(deps): update dependency jscs to v3 (master) - autoclosed Dec 9, 2023
@appcues-wss appcues-wss bot closed this Dec 9, 2023
@appcues-wss appcues-wss bot deleted the whitesource-remediate/master-jscs-3.x branch December 9, 2023 13:07
@appcues-wss appcues-wss bot restored the whitesource-remediate/master-jscs-3.x branch December 13, 2023 19:10
@appcues-wss appcues-wss bot changed the title chore(deps): update dependency jscs to v3 (master) - autoclosed chore(deps): update dependency jscs to v3 (master) Dec 13, 2023
@appcues-wss appcues-wss bot reopened this Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
security fix Security fix generated by WhiteSource
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants