This preset will be used in the Meteor guide.
ESLint-plugin-Meteor
Meteor specific linting rules for ESLint
This gif shows integration of ESLint-plugin-Meteor into Atom. Find out more in the integration guide.
Quickstart
Installation
Install ESLint and this plugin either locally or globally.
$ npm install eslint --save-dev
$ npm install eslint-plugin-meteor --save-dev
Configuration
Add these keys to your .eslintrc.json file:
{
"plugins": ["meteor"],
"extends": ["plugin:meteor/recommended"]
}
For a more thorough introduction, read the setup guide.
An article with detailed setup instructions can be found here.
List of supported rules
Best Practices
- General
- no-zero-timeout: Prevent usage of Meteor.setTimeout with zero delay
- Session
- no-session: Prevent usage of Session
- prefer-session-equals: Prefer
Session.equalsin conditions
- Security
- audit-argument-checks: Enforce check on all arguments passed to methods and publish functions
- Blaze
- template-names: Naming convention for templates
- no-template-lifecycle-assignments: Prevent deprecated template lifecycle callback assignments
- eventmap-params: Force consistent event handler parameter names in event maps
Core API
- currently no rules implemented
Recommended Configuration
This plugin exports a recommended configuration that enforce good Meteor practices.
To enable this configuration use the extends property in your .eslintrc config file:
{
"plugins": [
"meteor"
],
"extends": ["eslint:recommended", "plugin:meteor/recommended"]
}
See ESLint documentation for more information about extending configuration files.
The rules enabled in this configuration are:
- audit-argument-checks
- no-session
- no-template-lifecycle-assignments
- no-zero-timeout
- eventmap-params
- template-names
Limitations
ESLint-plugin-Meteor is not aware of where files are going to be executed, to keep the plugin simple. It will not warn when accessing client-only features on the server and vice versa.
Contributing
Read about set up of the development environment.
Thanks
This plugin is inspired by eslint-plugin-react.
License
ESLint-plugin-Meteor is licensed under the MIT License.
