Not allow to use React context in specific directory.
npm install eslint-plugin-no-allow-react-contextNot allow to use React context in specific directory.
``js`
class Component extends React.Component {
static contextTypes = {}; // <= Error
}
Install with npm:
npm install eslint-plugin-no-allow-react-context
Add eslint-plugin-no-allow-react-context to .eslintrc
``
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"no-allow-react-context"
],
"rules": {
"no-allow-react-context/no-allow-react-context": [2, {
"except": ["expect/dir/pattern/*/.js"]
}]
}
}
- except: string[]
- expect glob pattern
- If the pattern match the file name, the file should be ignored.
See Releases page.
Install devDependencies and Run npm test:
npm i -d && npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
MIT © azu