-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[eslint] Enforce @ignore before comment #3611
Conversation
WOW O.O That was fast 👍 👍 👍 Thanks 😍 @callemall/material-ui Take a look and merge, somebody else 😆 |
@@ -58,6 +58,7 @@ rules: | |||
prefer-const: 2 | |||
prefer-template: 2 | |||
quotes: [2, single, avoid-escape] | |||
require-@ignore-before-comment: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we enforce it with 2
?
My sublime text plugin is having trouble finding the definition of this rule. Is this only me? |
@oliviertassinari It's a custom rule, I don't think IDEs support them. Besides the build is passing, so I'm pretty sure it's IDE related. |
I see the same thing. This is making the top line of every file show a warning in my IDE 👎
|
This does not work with PoweredbySearch on Powereds-MacBook-Pro-2.local in ~/Development/repos/nathanmarks/material-ui(23h32m|pr/3611)
$ node_modules/.bin/eslint src
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/card/index.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/date-picker/index.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/DropDownMenu/index.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/grid-list/index.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/hoc/selectable-enhance.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
/Users/PoweredbySearch/Development/repos/nathanmarks/material-ui/src/index.js
1:1 warning Definition for rule 'require-@ignore-before-comment' was not found require-@ignore-before-comment
# it keeps going ;) ... etc |
It looks like the current implementation is tied to the gulp config. Can this be setup so that we can run Ideally we'd be able to just run |
@mbrookes rebase please 😅 |
@alitaheri this cannot be merged as is, it was gulp-only the way it was configured. That's why I added "Need Revision". I think it should be implemented as a plugin. We could use |
Yeah I agree 👍 👍 @mbrookes Maybe you can extend it a bit and make it a general purpose rule of it own. I'm sure many can benefit from it 👍 |
Oddly eslint doesn't support As we've dropped gulp, and to make this work effectively across editors, it requires a custom plugin: https://github.com/mbrookes/eslint-plugin-material-ui We can add additional rules to that as needed. |
What about publishing the eslint rules package for Material-UI from this repository? |
That would be better. Shall I hang it off root? |
Where should we put the folder for this new npm package? That's the hardest part. We could follow https://github.com/facebook/react/tree/master/packages with What do you think? |
Well I wouldn't advocate rearranging the directory structure just to accommodate this small package, especially as it is only a dev dependancy, rather than a package to be published. I had put it in |
@nathanmarks - yes, it was based on a discussion @alitaheri and I had earlier. But as I said above, this is only a dev dependancy, rather than a package to be published (assuming we can get past the Travis issue without resorting to publishing to npm), but even if not, it's still not a for-public-consumption package, so belongs within material-ui rather than along side it. That is to say, even if material-ui goes into packages (an unnecessary layer of nesting IMHO, but I'll save that for the other discussion), this package would still reside within it. |
Thanks @oliviertassinari, it looks like the problem was the blanket exclusion of This I've made it |
@@ -0,0 +1,50 @@ | |||
/** | |||
* @fileoverview Prevent the usage of sessionStorage and localStorage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mbrookes Think this comment section needs a cleanup 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, whoops! 😲
@oliviertassinari @mbrookes are we happy with this sitting in the root for now? Or should it go under a subfolder? |
That's fine for me under the root folder for now. |
"scripts": { | ||
"test": "node_modules/mocha/bin/_mocha -- tests/lib/**/*.js" | ||
}, | ||
"devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these since the root repo has both mocha and eslint?
@oliviertassinari FYI, the |
I can move it to packages to get the ball rolling if that's the direction we're taking, or we can merge as is and move it later. Let me know. |
@mbrookes did you just rebase? what about also adding |
I'm assuming the commit's will get squashed, and I'll update the commit message then - not too fussed about the ones that will be deleted. Since all of @oliviertassinari's eslint updates have [eslint] as the prefix, so I went with the for the PR title. |
@mbrookes Ahhh sorry, I thought you just rebased/squashed because everything was outdated! |
No, you're right, I rebased, then noticed that the Stepper @ignores were already fixed, so dropped that commit and force pushed. But haven't squashed yet... will do that if all looks good. |
"name": "eslint-plugin-material-ui", | ||
"version": "1.0.0", | ||
"description": "Custom eslint rules for Material-UI", | ||
"repository": "https://github.com/callemall/material-ui/packages/eslint-pluigin-material-ui", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in pluigin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew I should have cut & pasted that! And I need 👓 .
Add a custom eslint plugin with a rule to enforce that the docgen @ignore tage be at the start of the comment.
That looks good to me 👍. |
Thanks, that's good enough for me. 😄 |
[eslint] Enforce @ignore before comment
docs demo, and is linted.Adds a custom eslint rule to enforce placing @ignore at the start of the comment block.
Resolves: #3589 (comment)