Skip to content

Commit

Permalink
use 'error' instead of 2 in the rule configs
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 3, 2016
1 parent e8b0a30 commit ac03fee
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
48 changes: 24 additions & 24 deletions config/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,36 @@ module.exports = {
]
},
rules: {
'no-use-extend-native/no-use-extend-native': 2,
'promise/param-names': 2,
'import/default': 2,
'import/export': 2,
'import/extensions': [2, {
'no-use-extend-native/no-use-extend-native': 'error',
'promise/param-names': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': ['error', {
js: 'never',
json: 'never',
jsx: 'never'
}],
'import/first': 2,
'import/named': 2,
'import/namespace': [2, {allowComputed: true}],
'import/no-absolute-path': 2,
'import/no-dynamic-require': 2,
'import/no-webpack-loader-syntax': 2,
'import/newline-after-import': 2,
'import/no-amd': 2,
'import/first': 'error',
'import/named': 'error',
'import/namespace': ['error', {allowComputed: true}],
'import/no-absolute-path': 'error',
'import/no-dynamic-require': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/newline-after-import': 'error',
'import/no-amd': 'error',
// enable this sometime in the future when Node.js has ES2015 module support
// 'import/unambiguous': 2,
// 'import/unambiguous': 'error',
// enable this sometime in the future when Node.js has ES2015 module support
// 'import/no-commonjs': 2,
// 'import/no-commonjs': 'error',
// looks useful, but too unstable at the moment
// 'import/no-deprecated': 2,
'import/no-extraneous-dependencies': 2,
'import/no-mutable-exports': 2,
'import/no-named-as-default-member': 2,
'import/no-named-as-default': 2,
'import/no-unresolved': [2, {commonjs: true}],
'import/order': 2,
'import/prefer-default-export': 2,
'import/no-unassigned-import': 2
// 'import/no-deprecated': 'error',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/no-named-as-default-member': 'error',
'import/no-named-as-default': 'error',
'import/no-unresolved': ['error', {commonjs: true}],
'import/order': 'error',
'import/prefer-default-export': 'error',
'import/no-unassigned-import': 'error'
}
};
10 changes: 5 additions & 5 deletions options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ function buildConfig(opts) {

if (opts.space) {
const spaces = typeof opts.space === 'number' ? opts.space : 2;
config.rules.indent = [2, spaces, {SwitchCase: 1}];
config.rules.indent = ['error', spaces, {SwitchCase: 1}];

// only apply if the user has the React plugin
if (opts.cwd && resolveFrom(opts.cwd, 'eslint-plugin-react')) {
config.plugins = config.plugins.concat('react');
config.rules['react/jsx-indent-props'] = [2, spaces];
config.rules['react/jsx-indent'] = [2, spaces];
config.rules['react/jsx-indent-props'] = ['error', spaces];
config.rules['react/jsx-indent'] = ['error', spaces];
}
}

if (opts.semicolon === false) {
config.rules.semi = [2, 'never'];
config.rules['semi-spacing'] = [2, {
config.rules.semi = ['error', 'never'];
config.rules['semi-spacing'] = ['error', {
before: false,
after: true
}];
Expand Down
2 changes: 1 addition & 1 deletion test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('.lintText() - JSX support', t => {
test('.lintText() - plugin support', t => {
const results = fn.lintText('var React;\nReact.render(<App/>);\n', {
plugins: ['react'],
rules: {'react/jsx-no-undef': 2}
rules: {'react/jsx-no-undef': 'error'}
}).results;
t.true(hasRule(results, 'react/jsx-no-undef'));
});
Expand Down
10 changes: 5 additions & 5 deletions test/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,27 @@ test('buildConfig: esnext', t => {

test('buildConfig: space: true', t => {
const config = manager.buildConfig({space: true});
t.deepEqual(config.rules.indent, [2, 2, {SwitchCase: 1}]);
t.deepEqual(config.rules.indent, ['error', 2, {SwitchCase: 1}]);
});

test('buildConfig: space: 4', t => {
const config = manager.buildConfig({space: 4});
t.deepEqual(config.rules.indent, [2, 4, {SwitchCase: 1}]);
t.deepEqual(config.rules.indent, ['error', 4, {SwitchCase: 1}]);
});

test('buildConfig: semicolon', t => {
const config = manager.buildConfig({semicolon: false});
t.deepEqual(config.rules, {
'semi': [2, 'never'],
'semi-spacing': [2, {
'semi': ['error', 'never'],
'semi-spacing': ['error', {
before: false,
after: true
}]
});
});

test('buildConfig: rules', t => {
const rules = {'object-curly-spacing': [2, 'always']};
const rules = {'object-curly-spacing': ['error', 'always']};
const config = manager.buildConfig({rules});
t.deepEqual(config.rules, rules);
});
Expand Down

0 comments on commit ac03fee

Please sign in to comment.