1.0.1 • Published 8 years ago

eslint-plugin-no-allow-react-context v1.0.1

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

eslint-plugin-no-allow-react-context

Not allow to use React context in specific directory.

class Component extends React.Component { 
    static contextTypes = {}; // <= Error
}

Install

Install with npm:

npm install eslint-plugin-no-allow-react-context

Usage

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.

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

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-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu