eslint-config
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13
754
71
0
37470
21
1
+ Addedeslint@^2.1.0
+ Addedacorn@3.3.05.7.4(transitive)
+ Addedacorn-jsx@3.0.1(transitive)
+ Addedajv@4.11.8(transitive)
+ Addedajv-keywords@1.5.1(transitive)
+ Addedansi-escapes@1.4.0(transitive)
+ Addedansi-regex@2.1.13.0.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedcaller-path@0.1.0(transitive)
+ Addedcallsites@0.2.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcircular-json@0.3.3(transitive)
+ Addedcli-cursor@1.0.2(transitive)
+ Addedcli-width@2.2.1(transitive)
+ Addedco@4.6.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedd@1.0.2(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddoctrine@1.5.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes5-ext@0.10.64(transitive)
+ Addedes6-iterator@2.0.3(transitive)
+ Addedes6-map@0.1.5(transitive)
+ Addedes6-set@0.1.6(transitive)
+ Addedes6-symbol@3.1.4(transitive)
+ Addedes6-weak-map@2.0.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedescope@3.6.0(transitive)
+ Addedeslint@2.13.1(transitive)
+ Addedesniff@2.0.1(transitive)
+ Addedespree@3.5.4(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedevent-emitter@0.3.5(transitive)
+ Addedexit-hook@1.1.1(transitive)
+ Addedext@1.7.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfigures@1.7.0(transitive)
+ Addedfile-entry-cache@1.3.1(transitive)
+ Addedflat-cache@1.3.4(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglobals@9.18.0(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedignore@3.3.10(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinquirer@0.12.0(transitive)
+ Addedis-fullwidth-code-point@1.0.02.0.0(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-resolvable@1.1.0(transitive)
+ Addedisarray@1.0.02.0.5(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedjson-stable-stringify@1.2.1(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addedmute-stream@0.0.5(transitive)
+ Addednext-tick@1.1.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-is-inside@1.0.2(transitive)
+ Addedpluralize@1.2.1(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedprogress@1.1.8(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreadline2@1.0.1(transitive)
+ Addedrequire-uncached@1.0.3(transitive)
+ Addedresolve-from@1.0.1(transitive)
+ Addedrestore-cursor@1.0.1(transitive)
+ Addedrimraf@2.6.3(transitive)
+ Addedrun-async@0.1.0(transitive)
+ Addedrx-lite@3.1.2(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedshelljs@0.6.1(transitive)
+ Addedslice-ansi@0.0.4(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring-width@1.0.22.1.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.14.0.0(transitive)
+ Addedstrip-json-comments@1.0.4(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtable@3.8.3(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtype@2.7.3(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addeduser-home@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite@0.2.1(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedapp-root-path@^1.0.0
- Removedapp-root-path@1.4.0(transitive)