Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 26.9k
Custom Lint Rule no-css-modules#114
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
| * Copyright (c) 2015-present, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| */ | ||
| module.exports = { | ||
| create: function (context) { | ||
| return { | ||
| ImportDeclaration: function(node) { | ||
| if (node) { | ||
| var specifiers = node.specifiers || []; | ||
| var value = node.source && node.source.value; | ||
| if (value && value.indexOf('.css') !== -1 && specifiers.length) { | ||
| for (var i = 0; i < specifiers.length; i++) { | ||
| var specifier = specifiers[i]; | ||
| context.report(specifier, 'CSS modules import is restricted. ' + | ||
| 'Please remove the \'{{importName}}\' portion of the import.', { | ||
| importName: specifier.imported ? specifier.imported.name : specifier.local.name | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -86,7 +86,8 @@ module.exports = { | ||
| }, | ||
| eslint: { | ||
| configFile: path.join(__dirname, 'eslint.js'), | ||
| useEslintrc: false | ||
| useEslintrc: false, | ||
| rulesdir: 'config/rules' | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this still work after #149? | ||
| }, | ||
| postcss: function() { | ||
| return [autoprefixer]; | ||
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 wouldn't think this check is necessary right?
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.
Its guarded in one of the eslint rules with
ImportDeclaration, happy to remove it if you dont think its necessary