Some of the eslint rules to disable es2015
Install ESLint either locally or globally.
$ npm install eslint
If you installed ESLint
globally, you have to install React plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-no-es2015
Add plugins
section and specify ESLint-plugin-no-es2015 as a plugin.
{
"plugins": [
"no-es2015"
]
}
and you can use this plugin like this.
"rules": {
"no-es2015/no-object-computed-properties": 2,
"no-es2015/no-object-shorthand-properties": 2,
"no-es2015/no-object-shorthand-method": 2,
"no-es2015/only-var": 2,
"no-es2015/no-destructuring-assignment": 2,
"no-es2015/no-destructuring-params": 2,
"no-es2015/no-class": 2,
"no-es2015/no-default-params": 2,
"no-es2015/no-spread-element": 2,
"no-es2015/no-rest-params": 2,
"no-es2015/no-generator-function": 2,
"no-es2015/no-arrow-func": 2,
"no-es2015/no-for-of": 2,
"no-es2015/no-import": 2,
"no-es2015/no-template-strin": 2
}
no-es2015/only-var
: you can't uselet
orconst
.no-es2015/no-destructuring-assignment
: you can't use destructuring-assignmentvar {a} = {a:1};
.no-es2015/no-destructuring-params
: you can't use destructuring-paramsfunction foo([a,b]) {} function bar({a}) {}
.no-es2015/no-class
: you can't use classclass A {}
.no-es2015/no-default-params
: you can't use default paramsfunction(a = 1) {}
.no-es2015/no-spread-element
: you can't use spread elementMath.Max(...[1,2,3])
.no-es2015/no-rest-params
: you can't use rest paramsfunction(...a) {}
.no-es2015/no-generator-function
: you can't use generator paramsfunction*foo() {}
.no-es2015/no-arrow-func
: you can't use arrow functionvar a = () => {}
.no-es2015/no-for-of
: you can't use for of statementfor(bar of foo) {}
.no-es2015/no-import
: you can't use importimport {foo} from 'foo'
.no-es2015/no-template-string
: you can't use template stringvar a = `i am a template string`
.no-object-computed-properties
: you can't use computed-properties{[foo]: bar}
no-object-shorthand-properties
: you can't use shorthand-properties{foo}
no-object-shorthand-method
: you can't use shorthand-method{foo() {}}