Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.eslintrc

410

dist/index.js

@@ -1,385 +0,49 @@

try{require("source-map-support").install();}
catch(err) {}
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
'use strict';
var _interopRequireDefault = __webpack_require__(1)['default'];
Object.defineProperty(exports, '__esModule', {
value: true
});
var _objectAssign = __webpack_require__(2);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _baseRules = __webpack_require__(3);
var _baseRules2 = _interopRequireDefault(_baseRules);
var _reactRules = __webpack_require__(4);
var _reactRules2 = _interopRequireDefault(_reactRules);
exports['default'] = function (isDev, task) {
var opts = {
isDev: isDev,
task: task
};
function findConfig() {
var rootPath = __webpack_require__(5).path;
var configFile = 'es6-config.json';
var moduleName = 'eslint-config';
var prod = rootPath + '/node_modules/@hfa/' + moduleName + '/dist/' + configFile + ')';
var dev = rootPath + '/lib/' + configFile;
return new RegExp(moduleName).test(rootPath) ? dev : prod;
}
return {
rules: (0, _objectAssign2['default'])({}, (0, _baseRules2['default'])(opts), (0, _reactRules2['default'])(opts)),
configFile: findConfig(),
useEslintrc: false
};
};
module.exports = exports['default'];
Object.defineProperty(exports, "__esModule", {
value: true
});
/***/ },
/* 1 */
/***/ function(module, exports) {
exports.default = function (opts) {
var react = opts.react;
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
var rules = (0, _baseRules2.default)(opts);
/***/ },
/* 2 */
/***/ function(module, exports) {
if (react) {
(0, _objectAssign2.default)(rules, (0, _reactRules2.default)(opts));
}
module.exports = require("object-assign");
return {
rules: rules,
configFile: _path2.default.join(__dirname, 'eslint-config.json'),
useEslintrc: false
};
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var _path = require('path');
'use strict';
var _interopRequireDefault = __webpack_require__(1)['default'];
Object.defineProperty(exports, '__esModule', {
value: true
});
var _objectAssign = __webpack_require__(2);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* @param {Object} opts
* @param {Boolean} opts.isDev
* @param {String} opts.lintEnv type of linting environment `web | test | build`
* @return {Object}
*/
exports['default'] = function (opts) {
var isDev = opts.isDev;
var lintEnv = opts.lintEnv;
var base = {
/**
* Strict mode
*/
// babel inserts 'use strict'; for us
'strict': [2, 'never'], // http://eslint.org/docs/rules/strict
/**
* ES6
*/
'no-var': 2, // http://eslint.org/docs/rules/no-var
'prefer-const': 2, // http://eslint.org/docs/rules/prefer-const
/**
* Variables
*/
//
// TODO: Up for discussion
'no-shadow': 0, // http://eslint.org/docs/rules/no-shadow
'no-shadow-restricted-names': 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
'no-undef': 2, // http://eslint.org/docs/rules/no-undef
'no-unused-vars': [2, { // http://eslint.org/docs/rules/no-unused-vars
'vars': 'local',
'args': 'after-used'
}],
'no-use-before-define': 2, // http://eslint.org/docs/rules/no-use-before-define
/**
* Possible errors
*/
'comma-dangle': [2, 'never'], // http://eslint.org/docs/rules/comma-dangle
'no-cond-assign': [2, 'always'], // http://eslint.org/docs/rules/no-cond-assign
'no-constant-condition': 1, // http://eslint.org/docs/rules/no-constant-condition
'no-dupe-keys': 2, // http://eslint.org/docs/rules/no-dupe-keys
'no-duplicate-case': 2, // http://eslint.org/docs/rules/no-duplicate-case
'no-empty': 2, // http://eslint.org/docs/rules/no-empty
'no-ex-assign': 2, // http://eslint.org/docs/rules/no-ex-assign
'no-extra-boolean-cast': 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
'no-extra-semi': 2, // http://eslint.org/docs/rules/no-extra-semi
'no-func-assign': 2, // http://eslint.org/docs/rules/no-func-assign
'no-inner-declarations': 2, // http://eslint.org/docs/rules/no-inner-declarations
'no-invalid-regexp': 2, // http://eslint.org/docs/rules/no-invalid-regexp
'no-irregular-whitespace': 2, // http://eslint.org/docs/rules/no-irregular-whitespace
'no-obj-calls': 2, // http://eslint.org/docs/rules/no-obj-calls
'no-sparse-arrays': 2, // http://eslint.org/docs/rules/no-sparse-arrays
'no-unreachable': 2, // http://eslint.org/docs/rules/no-unreachable
'use-isnan': 2, // http://eslint.org/docs/rules/use-isnan
'block-scoped-var': 2, // http://eslint.org/docs/rules/block-scoped-var
/**
* Best practices
*/
'consistent-return': 2, // http://eslint.org/docs/rules/consistent-return
'curly': [2, 'multi-line'], // http://eslint.org/docs/rules/curly
'default-case': 2, // http://eslint.org/docs/rules/default-case
'dot-notation': [2, { // http://eslint.org/docs/rules/dot-notation
'allowKeywords': true
}],
'eqeqeq': 2, // http://eslint.org/docs/rules/eqeqeq
'guard-for-in': 2, // http://eslint.org/docs/rules/guard-for-in
'no-caller': 2, // http://eslint.org/docs/rules/no-caller
'no-else-return': 2, // http://eslint.org/docs/rules/no-else-return
'no-eq-null': 2, // http://eslint.org/docs/rules/no-eq-null
'no-eval': 2, // http://eslint.org/docs/rules/no-eval
'no-extend-native': 2, // http://eslint.org/docs/rules/no-extend-native
'no-extra-bind': 2, // http://eslint.org/docs/rules/no-extra-bind
'no-fallthrough': 2, // http://eslint.org/docs/rules/no-fallthrough
'no-floating-decimal': 2, // http://eslint.org/docs/rules/no-floating-decimal
'no-implied-eval': 2, // http://eslint.org/docs/rules/no-implied-eval
'no-lone-blocks': 2, // http://eslint.org/docs/rules/no-lone-blocks
'no-loop-func': 2, // http://eslint.org/docs/rules/no-loop-func
'no-multi-str': 2, // http://eslint.org/docs/rules/no-multi-str
'no-native-reassign': 2, // http://eslint.org/docs/rules/no-native-reassign
'no-new': 2, // http://eslint.org/docs/rules/no-new
'no-new-func': 2, // http://eslint.org/docs/rules/no-new-func
'no-new-wrappers': 2, // http://eslint.org/docs/rules/no-new-wrappers
'no-octal': 2, // http://eslint.org/docs/rules/no-octal
'no-octal-escape': 2, // http://eslint.org/docs/rules/no-octal-escape
//'no-param-reassign': 2, // http://eslint.org/docs/rules/no-param-reassign
'no-proto': 2, // http://eslint.org/docs/rules/no-proto
'no-redeclare': 2, // http://eslint.org/docs/rules/no-redeclare
'no-return-assign': 2, // http://eslint.org/docs/rules/no-return-assign
'no-script-url': 2, // http://eslint.org/docs/rules/no-script-url
'no-self-compare': 2, // http://eslint.org/docs/rules/no-self-compare
'no-sequences': 2, // http://eslint.org/docs/rules/no-sequences
'no-throw-literal': 2, // http://eslint.org/docs/rules/no-throw-literal
'no-with': 2, // http://eslint.org/docs/rules/no-with
'radix': 2, // http://eslint.org/docs/rules/radix
'vars-on-top': 2, // http://eslint.org/docs/rules/vars-on-top
'wrap-iife': [2, 'any'], // http://eslint.org/docs/rules/wrap-iife
'yoda': 2, // http://eslint.org/docs/rules/yoda
/**
* Style
*/
'indent': [2, 2], // http://eslint.org/docs/rules/indent
'brace-style': [2, // http://eslint.org/docs/rules/brace-style
'1tbs', {
'allowSingleLine': true
}],
'quotes': [2, 'single', 'avoid-escape' // http://eslint.org/docs/rules/quotes
],
'camelcase': [2, { // http://eslint.org/docs/rules/camelcase
'properties': 'never'
}],
'comma-spacing': [2, { // http://eslint.org/docs/rules/comma-spacing
'before': false,
'after': true
}],
'comma-style': [2, 'last'], // http://eslint.org/docs/rules/comma-style
'eol-last': 2, // http://eslint.org/docs/rules/eol-last
'key-spacing': [2, { // http://eslint.org/docs/rules/key-spacing
'beforeColon': false,
'afterColon': true
}],
'new-cap': [2, { // http://eslint.org/docs/rules/new-cap
'newIsCap': true
}],
'no-multiple-empty-lines': [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
'max': 2
}],
'no-nested-ternary': 2, // http://eslint.org/docs/rules/no-nested-ternary
'no-new-object': 2, // http://eslint.org/docs/rules/no-new-object
'no-spaced-func': 2, // http://eslint.org/docs/rules/no-spaced-func
'no-trailing-spaces': 2, // http://eslint.org/docs/rules/no-trailing-spaces
'no-extra-parens': [2, 'functions'], // http://eslint.org/docs/rules/no-extra-parens
'no-underscore-dangle': 0, // http://eslint.org/docs/rules/no-underscore-dangle
'one-var': [2, 'never'], // http://eslint.org/docs/rules/one-var
'padded-blocks': [2, 'never'], // http://eslint.org/docs/rules/padded-blocks
'semi': [2, 'always'], // http://eslint.org/docs/rules/semi
'semi-spacing': [2, { // http://eslint.org/docs/rules/semi-spacing
'before': false,
'after': true
}],
'space-after-keywords': 2, // http://eslint.org/docs/rules/space-after-keywords
'space-before-blocks': 2, // http://eslint.org/docs/rules/space-before-blocks
'space-before-function-paren': [2, 'never'], // http://eslint.org/docs/rules/space-before-function-paren
'space-infix-ops': 2, // http://eslint.org/docs/rules/space-infix-ops
'space-return-throw-case': 2 // http://eslint.org/docs/rules/space-return-throw-case
//'spaced-comment': [2, 'always', {// http://eslint.org/docs/rules/spaced-comment
//'exceptions': ['-', '+'],
//'markers': ['=', '!'] // space here to support sprockets directives
//}] TODO: Figure out how to insert spaces in comments with vim
}; //end rules
var envs = {
web: {},
test: {},
build: {
'prefer-const': 0,
'no-process-exit': 0
}
};
var prod = {
web: {
'no-console': 1,
'no-debugger': 1,
'no-alert': 1
},
test: {
'no-console': 1,
'no-debugger': 1,
'no-alert': 1
},
build: {
'no-debugger': 1,
'no-alert': 1
}
};
var config = (0, _objectAssign2['default'])({}, base, envs[lintEnv]);
return isDev ? config : (0, _objectAssign2['default'])({}, config, prod[lintEnv]);
};
module.exports = exports['default'];
var _path2 = _interopRequireDefault(_path);
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var _objectAssign = require('object-assign');
'use strict';
var _interopRequireDefault = __webpack_require__(1)['default'];
Object.defineProperty(exports, '__esModule', {
value: true
});
var _objectAssign = __webpack_require__(2);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/**
* @param {Object} opts
* @param {Boolean} opts.isDev
* @return {Object}
*/
exports['default'] = function (opts) {
var isDev = opts.isDev;
var base = {
/**
* JSX style
*/
'react/display-name': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
'react/jsx-boolean-value': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-quotes': [2, 'double'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md
'react/jsx-no-undef': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
'react/jsx-sort-props': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-prop-types': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
'react/jsx-uses-react': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
'react/jsx-uses-vars': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
'react/no-did-mount-set-state': [2, 'allow-in-func'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
'react/no-did-update-set-state': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
'react/no-multi-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
'react/no-unknown-property': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
'react/prop-types': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
'react/react-in-jsx-scope': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
'react/self-closing-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/wrap-multilines': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
'react/sort-comp': [2, { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
'order': ['lifecycle', '/^on.+$/', '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', 'everything-else', '/^render.+$/', 'render']
}]
}; //end rules
var prod = {};
return isDev ? base : (0, _objectAssign2['default'])({}, base, prod);
};
module.exports = exports['default'];
var _objectAssign2 = _interopRequireDefault(_objectAssign);
/***/ },
/* 5 */
/***/ function(module, exports) {
var _baseRules = require('./base-rules');
module.exports = require("app-root-path");
var _baseRules2 = _interopRequireDefault(_baseRules);
/***/ }
/******/ ]);
//# sourceMappingURL=index.js.map
var _reactRules = require('./react-rules');
var _reactRules2 = _interopRequireDefault(_reactRules);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports['default'];
/**
* @param {Object}
* @param {Boolean} opts.isDev
* @param {String} opts.lintEnv
*
* @return {Object}
*/
import gulp from 'gulp';
import eslint from 'gulp-eslint';
import webpack from 'webpack';
import config from './webpack.config';
import eslintConfig from './lib';
import formatter from 'eslint-friendly-formatter';
import babel from 'gulp-babel';
import rename from 'gulp-rename';
import del from 'del';
const isWatch = process.argv.indexOf('watch') !== -1;
const compiler = webpack(config);
const src = [

@@ -14,17 +14,11 @@ './lib/**/*.js',

];
const dest = './dist';
const logger = function logger(err, stats) {
if (err) {
throw new Error(err);
}
gulp.task('clean', () => del(dest));
console.log(stats.toString());
};
gulp.task('lint', () => {
const lintConfig = eslintConfig({
isDev: false,
isDev: isWatch,
lintEnv: 'build'
});
console.log(lintConfig);

@@ -36,18 +30,18 @@ return gulp.src(src)

gulp.task('copy', () => {
gulp.task('copy', ['clean'], () => {
return gulp.src('./lib/*.json')
.pipe(gulp.dest(dest));
});
gulp.task('bundle', ['clean'], () => {
return gulp.src('./lib/**/*.js')
.pipe(babel())
.pipe(rename((fp) => fp.dirname = ''))
.pipe(gulp.dest('./dist'));
});
gulp.task('bundle', () => {
if (isWatch) {
compiler.watch({
aggregateTimeout: 300,
poll: true
}, logger);
} else {
compiler.run(logger);
}
gulp.task('release', ['lint', 'copy', 'bundle']);
gulp.task('default', ['release']);
gulp.task('watch', ['lint', 'bundle'], () => {
gulp.watch(src, ['lint']);
});
gulp.task('release', ['copy', 'bundle']);

@@ -9,9 +9,5 @@ import assign from 'object-assign';

*/
export default function(opts) {
const {isDev, lintEnv} = opts;
const base = {
/**
* Strict mode
*/
export default function(opts = {}) {
const {isDev, lintEnv, basic} = opts;
const extras = {
// babel inserts 'use strict'; for us

@@ -33,29 +29,11 @@ 'strict': [2, 'never'], // http://eslint.org/docs/rules/strict

'no-shadow-restricted-names': 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
'no-undef': 2, // http://eslint.org/docs/rules/no-undef
'no-unused-vars': [2, { // http://eslint.org/docs/rules/no-unused-vars
'vars': 'local',
'args': 'after-used'
}],
'no-use-before-define': 2, // http://eslint.org/docs/rules/no-use-before-define
/**
* Possible errors
*/
'comma-dangle': [2, 'never'], // http://eslint.org/docs/rules/comma-dangle
'comma-dangle': [1, 'never'], // http://eslint.org/docs/rules/comma-dangle
'no-cond-assign': [2, 'always'], // http://eslint.org/docs/rules/no-cond-assign
'no-constant-condition': 1, // http://eslint.org/docs/rules/no-constant-condition
'no-dupe-keys': 2, // http://eslint.org/docs/rules/no-dupe-keys
'no-duplicate-case': 2, // http://eslint.org/docs/rules/no-duplicate-case
'no-empty': 2, // http://eslint.org/docs/rules/no-empty
'no-ex-assign': 2, // http://eslint.org/docs/rules/no-ex-assign
'no-extra-boolean-cast': 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
'no-extra-semi': 2, // http://eslint.org/docs/rules/no-extra-semi
'no-func-assign': 2, // http://eslint.org/docs/rules/no-func-assign
'no-inner-declarations': 2, // http://eslint.org/docs/rules/no-inner-declarations
'no-invalid-regexp': 2, // http://eslint.org/docs/rules/no-invalid-regexp
'no-irregular-whitespace': 2, // http://eslint.org/docs/rules/no-irregular-whitespace
'no-obj-calls': 2, // http://eslint.org/docs/rules/no-obj-calls
'no-sparse-arrays': 2, // http://eslint.org/docs/rules/no-sparse-arrays
'no-unreachable': 2, // http://eslint.org/docs/rules/no-unreachable
'use-isnan': 2, // http://eslint.org/docs/rules/use-isnan
'block-scoped-var': 2, // http://eslint.org/docs/rules/block-scoped-var

@@ -66,5 +44,5 @@

*/
'consistent-return': 2, // http://eslint.org/docs/rules/consistent-return
'consistent-return': 0, // http://eslint.org/docs/rules/consistent-return
'curly': [2, 'multi-line'], // http://eslint.org/docs/rules/curly
'default-case': 2, // http://eslint.org/docs/rules/default-case
'default-case': 0, // http://eslint.org/docs/rules/default-case
'dot-notation': [2, { // http://eslint.org/docs/rules/dot-notation

@@ -88,3 +66,3 @@ 'allowKeywords': true

'no-native-reassign': 2, // http://eslint.org/docs/rules/no-native-reassign
'no-new': 2, // http://eslint.org/docs/rules/no-new
'no-new': 0, // http://eslint.org/docs/rules/no-new
'no-new-func': 2, // http://eslint.org/docs/rules/no-new-func

@@ -94,6 +72,6 @@ 'no-new-wrappers': 2, // http://eslint.org/docs/rules/no-new-wrappers

'no-octal-escape': 2, // http://eslint.org/docs/rules/no-octal-escape
//'no-param-reassign': 2, // http://eslint.org/docs/rules/no-param-reassign
'no-param-reassign': 0, // http://eslint.org/docs/rules/no-param-reassign
'no-proto': 2, // http://eslint.org/docs/rules/no-proto
'no-redeclare': 2, // http://eslint.org/docs/rules/no-redeclare
'no-return-assign': 2, // http://eslint.org/docs/rules/no-return-assign
'no-return-assign': 0, // http://eslint.org/docs/rules/no-return-assign
'no-script-url': 2, // http://eslint.org/docs/rules/no-script-url

@@ -108,19 +86,5 @@ 'no-self-compare': 2, // http://eslint.org/docs/rules/no-self-compare

'yoda': 2, // http://eslint.org/docs/rules/yoda
/**
* Style
*/
'indent': [2, 2], // http://eslint.org/docs/rules/indent
'brace-style': [
2, // http://eslint.org/docs/rules/brace-style
'1tbs', {
'allowSingleLine': true
}
],
'quotes': [
2, 'single', 'avoid-escape' // http://eslint.org/docs/rules/quotes
],
'camelcase': [2, { // http://eslint.org/docs/rules/camelcase
'properties': 'never'
}],
'comma-spacing': [2, { // http://eslint.org/docs/rules/comma-spacing

@@ -137,3 +101,9 @@ 'before': false,

'new-cap': [2, { // http://eslint.org/docs/rules/new-cap
'newIsCap': true
'newIsCap': true,
'capIsNew': false,
capIsNewExceptions: [
'RIT',
'Store',
'Actions'
]
}],

@@ -143,11 +113,9 @@ 'no-multiple-empty-lines': [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines

}],
'no-nested-ternary': 2, // http://eslint.org/docs/rules/no-nested-ternary
'no-new-object': 2, // http://eslint.org/docs/rules/no-new-object
'no-spaced-func': 2, // http://eslint.org/docs/rules/no-spaced-func
'no-trailing-spaces': 2, // http://eslint.org/docs/rules/no-trailing-spaces
'no-extra-parens': [2, 'functions'], // http://eslint.org/docs/rules/no-extra-parens
'no-underscore-dangle': 0, // http://eslint.org/docs/rules/no-underscore-dangle
'one-var': [2, 'never'], // http://eslint.org/docs/rules/one-var
'padded-blocks': [2, 'never'], // http://eslint.org/docs/rules/padded-blocks
'semi': [2, 'always'], // http://eslint.org/docs/rules/semi
'one-var': [2, {
uninitialized: 'always',
initialized: 'never'
}], // http://eslint.org/docs/rules/one-var
'padded-blocks': [0, 'never'], // http://eslint.org/docs/rules/padded-blocks
'semi': [1, 'always'], // http://eslint.org/docs/rules/semi
'semi-spacing': [2, { // http://eslint.org/docs/rules/semi-spacing

@@ -157,7 +125,6 @@ 'before': false,

}],
'space-after-keywords': 2, // http://eslint.org/docs/rules/space-after-keywords
'space-before-blocks': 2, // http://eslint.org/docs/rules/space-before-blocks
'space-before-function-paren': [2, 'never'], // http://eslint.org/docs/rules/space-before-function-paren
'space-infix-ops': 2, // http://eslint.org/docs/rules/space-infix-ops
'space-return-throw-case': 2 // http://eslint.org/docs/rules/space-return-throw-case
'keyword-spacing': 2 // http://eslint.org/docs/rules/space-return-throw-case
//'spaced-comment': [2, 'always', {// http://eslint.org/docs/rules/spaced-comment

@@ -167,4 +134,69 @@ //'exceptions': ['-', '+'],

//}] TODO: Figure out how to insert spaces in comments with vim
};
const base = {
/**
* Strict mode
*/
/**
* Variables
*/
//
// TODO: Up for discussion
'no-undef': 2, // http://eslint.org/docs/rules/no-undef
'no-unused-expressions': [1, { // http://eslint.org/docs/rules/no-unused-expressions.html
allowShortCircuit: true,
allowTernary: true
}],
'no-unused-vars': [1, { // http://eslint.org/docs/rules/no-unused-vars
'vars': 'local',
'args': 'none'
}],
/**
* Possible errors
*/
'no-dupe-keys': 2, // http://eslint.org/docs/rules/no-dupe-keys
'no-duplicate-case': 2, // http://eslint.org/docs/rules/no-duplicate-case
'no-empty': 2, // http://eslint.org/docs/rules/no-empty
'no-extra-semi': 2, // http://eslint.org/docs/rules/no-extra-semi
'no-func-assign': 2, // http://eslint.org/docs/rules/no-func-assign
'no-inner-declarations': 2, // http://eslint.org/docs/rules/no-inner-declarations
'no-invalid-regexp': 2, // http://eslint.org/docs/rules/no-invalid-regexp
'no-unreachable': 2, // http://eslint.org/docs/rules/no-unreachable
'use-isnan': 2, // http://eslint.org/docs/rules/use-isnan
// No debugger will be turned on on an environmental basis
'no-debugger': 0, // http://eslint.org/docs/rules/no-debugger
/**
* Style
*/
'indent': [1, 2, // http://eslint.org/docs/rules/indent
{
'SwitchCase': 1
}
],
'brace-style': [ // http://eslint.org/docs/rules/brace-style
2,
'1tbs', {
'allowSingleLine': true
}
],
'jsx-quotes': 2, // http://eslint.org/docs/rules/jsx-quotes.html
'camelcase': [2, { // http://eslint.org/docs/rules/camelcase
'properties': 'never'
}],
'no-nested-ternary': 2, // http://eslint.org/docs/rules/no-nested-ternary
'no-new-object': 0, // http://eslint.org/docs/rules/no-new-object
'no-trailing-spaces': 2, // http://eslint.org/docs/rules/no-trailing-spaces
'no-extra-parens': [2, 'functions'], // http://eslint.org/docs/rules/no-extra-parens
'no-underscore-dangle': 0 // http://eslint.org/docs/rules/no-underscore-dangle
}; //end rules
if (!basic) {
assign(base, extras);
}
const envs = {

@@ -174,2 +206,8 @@ web: {

test: {
'no-unused-expressions': 0,
'block-scoped-var': 0,
'no-unused-vars': 0,
'no-use-before-define': 0,
'no-extra-bind': 0,
'prefer-const': 0
},

@@ -186,3 +224,18 @@ build: {

'no-debugger': 1,
'no-alert': 1
'no-alert': 1,
'no-unused-expressions': [2, {
allowShortCircuit: true,
allowTernary: true
}],
'no-unused-vars': [2, {
'vars': 'local',
'args': 'none'
}],
'comma-dangle': 2,
'semi': [2, 'always'],
'indent': [2, 2,
{
'SwitchCase': 1
}
]
},

@@ -196,3 +249,18 @@ test: {

'no-debugger': 1,
'no-alert': 1
'no-alert': 1,
'no-unused-expressions': [2, {
allowShortCircuit: true,
allowTernary: true
}],
'no-unused-vars': [2, {
'vars': 'local',
'args': 'none'
}],
'comma-dangle': 2,
'semi': [2, 'always'],
'indent': [2, 2,
{
'SwitchCase': 1
}
]
}

@@ -199,0 +267,0 @@ };

@@ -0,1 +1,2 @@

import path from 'path';
import assign from 'object-assign';

@@ -5,23 +6,22 @@ import baseRules from './base-rules';

export default function(isDev, task) {
const opts = {
isDev,
task
};
/**
* @param {Object}
* @param {Boolean} opts.isDev
* @param {String} opts.lintEnv
*
* @return {Object}
*/
export default function(opts) {
const {react} = opts;
const rules = baseRules(opts);
function findConfig() {
const rootPath = require('app-root-path').path;
const configFile = 'es6-config.json';
const moduleName = 'eslint-config';
const prod = `${rootPath}/node_modules/@hfa/${moduleName}/dist/${configFile})`;
const dev = `${rootPath}/lib/${configFile}`;
return new RegExp(moduleName).test(rootPath) ? dev : prod;
if (react) {
assign(rules, reactRules(opts));
}
return {
rules: assign({}, baseRules(opts), reactRules(opts)),
configFile: findConfig(),
rules,
configFile: path.join(__dirname, 'eslint-config.json'),
useEslintrc: false
};
}

@@ -17,3 +17,2 @@ import assign from 'object-assign';

'react/jsx-boolean-value': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-quotes': [2, 'double'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md
'react/jsx-no-undef': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md

@@ -20,0 +19,0 @@ 'react/jsx-sort-props': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md

{
"name": "eslint-config",
"version": "0.1.0",
"description": "Linting Config for HFA Frontend",
"version": "0.2.0",
"description": "Linting Config",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "gulp release"
},
"repository": {
"type": "git",
"url": "git+https://github.com/HillaryClinton/eslint-config"
"url": "git+https://github.com/dtothefp/open-eslint-config"
},

@@ -16,22 +17,32 @@ "author": "DtotheFP",

"bugs": {
"url": "https://github.com/HillaryClinton/eslint-config/issues"
"url": "https://github.com/HillaryClinton/open-eslint-config/issues"
},
"homepage": "https://github.com/HillaryClinton/eslint-config#readme",
"homepage": "https://github.com/HillaryClinton/open-eslint-config#readme",
"dependencies": {
"app-root-path": "^1.0.0",
"eslint": "^2.1.0",
"object-assign": "^4.0.1"
},
"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.23",
"babel-eslint": "^4.1.1",
"babel-loader": "^5.3.2",
"babel-runtime": "^5.8.20",
"babel-core": "^6.5.2",
"babel-eslint": "^5.0.0-beta9",
"babel-plugin-add-module-exports": "^0.1.1",
"babel-plugin-react-transform": "^2.0.0-beta1",
"babel-plugin-transform-decorators-legacy": "^1.2.0",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-plugin-typecheck": "^3.5.1",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"babel-register": "^6.3.13",
"babel-runtime": "^6.3.19",
"del": "^2.2.0",
"eslint": "^2.0.0",
"eslint-friendly-formatter": "^1.2.2",
"eslint-plugin-react": "^3.3.1",
"gulp": "^3.9.0",
"gulp-eslint": "^1.0.0",
"json-loader": "^0.5.2",
"webpack": "^1.12.0"
"eslint-plugin-react": "^3.2.3",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-eslint": "^2.0.0-rc-3",
"gulp-rename": "^1.2.2"
}
}
# eslint-config
Configuration for JavaScript code linting.
#### Gulp
- must be used with `gulp-eslint@2`
```js
import eslintConfig from 'eslint-config';
import formatter from 'eslint-friendly-formatter';
gulp.task('lint', () => {
const lintConfig = eslintConfig({
isDev: true,
lintEnv: 'build'
});
return gulp.src(src)
.pipe(eslint(lintConfig))
.pipe(eslint.format(formatter));
});
```
#### Webpack
```js
import eslintConfig from 'eslint-config';
const {rules, configFile} = eslintConfig({/*options*/});
export default {
entry: //
output: //
eslint: {
rules,
configFile,
formatter,
emitError: false,
emitWarning: false,
failOnWarning: !isDev,
failOnError: !isDev
}
}
```
## API
### eslint(options)
#### options.isDev
Type: `Boolean`
Allows `debugger` and `console` as well as being lighter on other rules
#### options.basic
Type: `Boolean`
Only applies a small subset of rules
#### options.lintEnv
Type: `String` 'build', 'web', 'test'
Changes rules per env
#### options.react
Type: `Boolean`
Add rules for React/JSX

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc