Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

@graingert
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Jul 31, 2017
@graingert
Copy link
Contributor Author

graingert commented Jul 31, 2017

hmm travis isn't even running oh yes it is

"wrap-regex": "off",
"yield-star-spacing": "error",
"yoda": "off",
"no-unused-vars": "off",
Copy link
Contributor Author

@graingert graingert Jul 31, 2017

Choose a reason for hiding this comment

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

I had to turn this off because there's loads of these!

"jasmine": true
},
"rules": {
"no-native-reassign": "off",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what are you guys doing 🤕

@@ -1,6 +1,6 @@
describe('MdTabsPaginationService', function() {

const TAB_WIDTH = 100;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice try at ES2015 support.

You should configure babel properly and use let/const for everything if you're going to use them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mgol re: the es6 flag es2015 constructs are banned ^

case 'layout-margin' :
case 'layout-fill' :
case 'layout-wrap' :
case 'layout-nowrap' :
Copy link
Contributor Author

Choose a reason for hiding this comment

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

?????????

self[colorType + 'Color'] = function() {
var args = Array.prototype.slice.call(arguments);
// eslint-disable-next-line no-console
console.warn('$mdThemingProviderTheme.' + colorType + 'Color() has been deprecated. ' +
Copy link
Contributor Author

@graingert graingert Jul 31, 2017

Choose a reason for hiding this comment

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

should use probably use:

$injector.invoke(['$log', function($log) {
  $log.warn(...);
});

@graingert graingert force-pushed the eslint branch 2 times, most recently from 7648e85 to 1988972 Compare August 1, 2017 09:55
@graingert graingert changed the title Configure ESLint Fixes #9261 chore(eslit): Configure ESLint Fixes #9261 Aug 1, 2017
@graingert graingert changed the title chore(eslit): Configure ESLint Fixes #9261 chore(eslint): Configure ESLint Fixes #9261 Aug 1, 2017

self[colorType + 'Color'] = function() {
var args = Array.prototype.slice.call(arguments);
// eslint-disable-next-line no-console
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want no-console in tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't look like a test. We always want no-console because Angular provides a log service

$scope.currentNavItem = 'page1';

$scope.goto = function(page) {
console.log("Goto " + page);
Copy link
Member

Choose a reason for hiding this comment

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

I'd leave console.logs as they are outside of source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's bad form to recommend use of globals that Angular provides injectables for. It leads to the spreading of bad habits

.eslintrc.json Outdated
@@ -0,0 +1,271 @@
{
"env": {
"es6": true
Copy link
Member

Choose a reason for hiding this comment

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

Why enable es6? I think ES5 should be enforced which also means parserOptions.ecmaVersion needs to be set to 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh pretty sure this flag doesn't do anything anymore

Copy link
Member

Choose a reason for hiding this comment

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

How so? It defines ES2015 globals like Set or Promise. Wed don't want that here as some of our supported environments don't have those globals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well I'm going to remove it anyway

@mgol
Copy link
Member

mgol commented Aug 16, 2017

I added some comments. At a very first sight this looks good but someone from the Material team should verify, especially with regards to concrete rules defined. cc @ThomasBurleson @EladBezalel

@graingert
Copy link
Contributor Author

graingert commented Aug 16, 2017

@mgol I auto-generated the rules, it's based on what rules from eslint recommended already pass

@graingert
Copy link
Contributor Author

@mgol thanks for looking at this PR, I'd rather you look at #10826 because that makes some changes to comply with a stricter set of eslint rules. (And I'm running it in production now)

@graingert
Copy link
Contributor Author

@mgol

especially with regards to concrete rules defined

angular-material could definitely do with switching to a stricter styleguide, it's got a lot of inconsistent and redundant stuff in.

@mgol
Copy link
Member

mgol commented Aug 16, 2017

I'm confused, #10826 seems to have lots of unrelated commits. Single PRs should be about a single thing as otherwise it's hard to review. There should be one PR for ESLint setup, then another for any $window-related changes etc.

@@ -0,0 +1,268 @@
{
"extends": "eslint:recommended",
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather not extend any built-in preset as they can change. We should define our own rules ourselves.

Copy link
Contributor Author

@graingert graingert Aug 16, 2017

Choose a reason for hiding this comment

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

@mgol eslint:recommended is a very carefully managed preset, and any changes to it are signaled via semver.

@graingert
Copy link
Contributor Author

@ThomasBurleson can I get a review here or #10826 please?

@graingert
Copy link
Contributor Author

@ThomasBurleson rebased over conflicts

options.hideBackdrop = function hideBackdrop($destroy) {
if (options.backdrop) {
if ( !!$destroy ) options.backdrop.remove();
if ( $destroy ) options.backdrop.remove();
Copy link
Contributor

Choose a reason for hiding this comment

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

ESLint says that !! should be replaced by Boolean($destroy) for this rule. Is there a reason that you don't think that guidance applies here and in the other instances of this replacement in the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was autofixed. It's because there's no need to coerce with if ( ... )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also no-implicit-coercion is not enabled in eslint:recommended https://eslint.org/docs/rules/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the rule that applied in this location: https://eslint.org/docs/rules/no-extra-boolean-cast

@Splaktar
Copy link
Contributor

Is there an associated issue or forum thread where adding ESLint to the project was discussed?

@graingert
Copy link
Contributor Author

@Splaktar #9261

Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

Looks like a good start to me.

@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Nov 21, 2017
@graingert
Copy link
Contributor Author

@Splaktar there's stuff in the merge queue from back in March when are you expecting to actually merge them?

@Splaktar
Copy link
Contributor

@graingert PRs with the merge ready label are getting run through presubmit tonight. Some of them may be merged tomorrow. Our top priority atm is to catch up with the merge queue and start putting out small releases on a regular basis.

@Splaktar Splaktar added P4: minor Minor issues. May not be fixed without community contributions. type: chore labels Dec 11, 2017
@andrewseguin
Copy link
Contributor

Needs rebase

@andrewseguin andrewseguin added the needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved label Dec 12, 2017
@graingert
Copy link
Contributor Author

@andrewseguin done

@graingert
Copy link
Contributor Author

@Splaktar how did presubmit go?

@andrewseguin
Copy link
Contributor

Please rebase again

@graingert
Copy link
Contributor Author

Please rebase again

😡

@graingert
Copy link
Contributor Author

@andrewseguin rebased. Can you merge this one in before the others, otherwise I have to fix everyone else's eslint violations each time.

@andrewseguin andrewseguin merged commit d9eb909 into angular:master Dec 12, 2017
@graingert graingert deleted the eslint branch December 12, 2017 22:57
@Splaktar
Copy link
Contributor

@graingert sorry for the delay and the ordering of the merges, doh. Glad that we got this in though. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved P4: minor Minor issues. May not be fixed without community contributions. pr: merge ready This PR is ready for a caretaker to review type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants