Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Remove JSCS? #947

Closed
pdehaan opened this issue Jul 22, 2016 · 1 comment
Closed

Remove JSCS? #947

pdehaan opened this issue Jul 22, 2016 · 1 comment
Assignees

Comments

@pdehaan
Copy link
Collaborator

pdehaan commented Jul 22, 2016

Not quite dead yet, but all development has moved to ESLint: http://eslint.org/blog/2016/07/jscs-end-of-life

Possibly worth seeing what rules we have that we can port over to our .eslintrc and remove the dependency for a leaner install with fewer deps.
For converting .jscsrc, I like polyjuice, but not sure how/if it handles the presets (since we seem to be using a Google preset).

@pdehaan
Copy link
Collaborator Author

pdehaan commented Jul 22, 2016

A bit of further investigation is mildly (very mildly) interesting.

$ cat .jscsrc

{
  "preset": "google",
  "fileExtensions": [".js", ".jsm"],
  "excludeFiles": ["test/lib/httpd.js", "test/test-httpd.js", "logs/**", "node_modules/**", "data/content/**", "firefox/**", "**/*.bundle.js"],
  "maximumLineLength": false,
  "esnext": true,
  "validateQuoteMarks": false,
  "requireCamelCaseOrUpperCaseIdentifiers": null
}
$ ./node_modules/.bin/polyjuice --version // 2.1.9

$ ./node_modules/.bin/polyjuice --jscs=.jscsrc

{
  "rules": {
    "max-len": 0,
    "quotes": 0
  }
}

Pretty boring. But it gets mildly more interesting if we copy the "google" preset into our local .jscsrc file and run the converter again. We're left with the following [deduped] rules:

"brace-style": 2,
"curly": [2, "all"],
"dot-notation": 2,
"eol-last": 2,
"indent": [2, 2, {"SwitchCase": 1}],
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"keyword-spacing": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": 2,
"no-spaced-func": 2,
"no-with": 2,
"one-var": [2, "never"],
"operator-linebreak": [2, "after"],
"space-before-blocks": [2, "always"],
"space-in-parens": [2, "never"],
"valid-jsdoc": [1, {"requireReturn": false, "requireParamDescription": false, "requireReturnDescription": false}]

Now if we re-run $ ./node_modules/.bin/eslint ., we get the following (where the 72 warnings are all JSDoc rule violations):

✖ 119 problems (47 errors, 72 warnings)

Rerunning with $ eslint --fix auto-fixes most of the errors automatically:

✖ 90 problems (18 errors, 72 warnings)

✗ ./node_modules/.bin/eslint . --fix

/Users/pdehaan/dev/github/mozilla/activity-streams/content-src/components/LinkMenuButton/LinkMenuButton.js
  5:65  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/content-src/components/LoadMore/LoadMore.js
  14:36  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/content-src/components/Search/Search.js
  267:25  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/content-src/reducers/SetRowsOrError.js
  34:16  error  Closing curly brace does not appear on the same line as the subsequent block  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/lib/MetadataStore.js
  345:14  error  Closing curly brace does not appear on the same line as the subsequent block  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/lib/PerfMeter.js
  35:11  error  Extra space before value for key 'sum'  key-spacing

/Users/pdehaan/dev/github/mozilla/activity-streams/lib/PlacesProvider.js
  753:16  error  Closing curly brace does not appear on the same line as the subsequent block  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/lib/SearchProvider.js
  273:12  error  Extra space before value for key 'search'  key-spacing

/Users/pdehaan/dev/github/mozilla/activity-streams/lib/TabTracker.js
  274:56  error  Statement inside of curly braces should be on next line  brace-style
  275:58  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/test/lib/PlacesTestUtils.js
  76:63  error  ':' should be placed at the end of the line  operator-linebreak

/Users/pdehaan/dev/github/mozilla/activity-streams/test/lib/utils.js
  30:3   error  Closing curly brace does not appear on the same line as the subsequent block  brace-style
  58:22  error  Statement inside of curly braces should be on next line                       brace-style
  59:20  error  Statement inside of curly braces should be on next line                       brace-style
  60:20  error  Statement inside of curly braces should be on next line                       brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/test/test-MetadataStore.js
  166:26  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/test/test-PerfMeter.js
  119:28  error  Statement inside of curly braces should be on next line  brace-style

/Users/pdehaan/dev/github/mozilla/activity-streams/test/test-RecommendationProvider.js
  59:26  error  Statement inside of curly braces should be on next line  brace-style

✖ 18 problems (18 errors, 0 warnings)

@pdehaan pdehaan self-assigned this Jul 22, 2016
@jaredlockhart jaredlockhart added this to the Backlog milestone Jul 25, 2016
@Mardak Mardak modified the milestones: Fraser River (August 14), Backlog Aug 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants