Skip to content

Commit

Permalink
Lint for disallowed imports (#175)
Browse files Browse the repository at this point in the history
* Lint for disallowed imports

* Add lodash-es and @carbon/icons-react to disallowed imports

* Update eslintrc rules

* Re-add rule for @carbon/icons-react
  • Loading branch information
brandones committed Sep 15, 2021
1 parent 3cb0c89 commit 96f2e30
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion .eslintrc
@@ -1,5 +1,36 @@
{
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"parser": "@babel/eslint-parser",
"ignorePatterns": ["**/*.test.tsx"]
"ignorePatterns": ["**/*.test.tsx"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
},
{
"name": "lodash-es",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
},
{
"name": "@carbon/icons-react",
"message": "Import from `@carbon/icons-react/es`. e.g. `import ChevronUp16 from '@carbon/icons-react/es/chevron--up/16'`"
}
],
"patterns": [
{
"group": ["carbon-components-react/lib/*"],
"message": "Import from `carbon-components-react`. e.g. `import { Toggle } from 'carbon-components-react'`"
},
{
"group": ["@carbon/icons-react/lib/*"],
"message": "Import from `@carbon/icons-react/es`. e.g. `import ChevronUp16 from '@carbon/icons-react/es/chevron--up/16'`"
}
]
}
]
}
}

0 comments on commit 96f2e30

Please sign in to comment.