diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 85da40e..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loose": "all" -} diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1521c8b..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index ef44324..0000000 --- a/.eslintrc +++ /dev/null @@ -1,171 +0,0 @@ -env: - es6: true - mocha: true - node: true - -extends: 'eslint:recommended' - -parser: 'babel-eslint' - -plugins: - - babel - -root: true - -rules: - # Disabled Overrides (handled by JSCS) - array-bracket-spacing: 0 - arrow-parens: 0 - block-spacing: 0 - brace-style: 0 - camelcase: 0 - comma-dangle: 0 - comma-spacing: 0 - comma-style: 0 - consistent-return: 0 - curly: 0 - dot-notation: 0 - eol-last: 0 - func-names: 0 - indent: 0 - key-spacing: 0 - linebreak-style: 0 - lines-around-comment: 0 - new-cap: 0 - newline-after-var: 0 - no-catch-shadow: 0 - no-empty-label: 0 - no-empty: 0 - no-label-var: 0 - no-labels: 0 - no-mixed-spaces-and-tabs: 0 - no-multi-spaces: 0 - no-multi-str: 0 - no-multiple-empty-lines: 0 - no-shadow: 0 - no-spaced-func: 0 - no-undefined: 0 - no-underscore-dangle: 0 - no-warning-comments: 0 - no-with: 0 - object-curly-spacing: 0 - one-var: 0 - operator-linebreak: 0 - padded-blocks: 0 - quote-props: 0 - quotes: 0 - semi-spacing: 0 - semi: 0 - space-after-keywords: 0 - space-before-blocks: 0 - space-before-function-paren: 0 - space-in-parens: 0 - space-infix-ops: 0 - space-unary-ops: 0 - spaced-comment: 0 - strict: 0 - wrap-iife: 0 - yoda: 0 - - # Possible Errors - no-extra-parens: 2 - no-unexpected-multiline: 2 - valid-jsdoc: 2 - - # Best Practices - accessor-pairs: 2 - block-scoped-var: 2 - complexity: [2, 6] - default-case: 2 - dot-location: [2, property] - eqeqeq: [2, smart] - no-alert: 2 - no-caller: 2 - no-div-regex: 2 - no-else-return: 2 - no-eq-null: 2 - no-eval: 2 - no-extend-native: 2 - no-extra-bind: 2 - no-floating-decimal: 2 - no-implied-eval: 2 - no-iterator: 2 - no-lone-blocks: 2 - no-loop-func: 2 - no-native-reassign: 2 - no-new-func: 2 - no-new-wrappers: 2 - no-new: 2 - no-octal-escape: 2 - no-process-env: 2 - no-proto: 2 - no-return-assign: 2 - no-script-url: 2 - no-self-compare: 2 - no-sequences: 2 - no-throw-literal: 2 - no-unused-expressions: 2 - no-useless-call: 2 - no-useless-concat: 2 - no-void: 2 - radix: 2 - vars-on-top: 2 - - # Variables - no-shadow-restricted-names: 2 - no-undef-init: 2 - no-use-before-define: 2 - - # Node.js and CommonJS - no-mixed-requires: 2 - no-new-require: 2 - no-path-concat: 2 - no-process-exit: 2 - no-restricted-modules: 2 - no-sync: 2 - - # Stylistic issues - computed-property-spacing: 2 - consistent-this: 2 - func-style: [2, declaration, { allowArrowFunctions: true }] - id-length: [2, { exceptions: [_, e, i] }] - max-nested-callbacks: [2, 4] - new-parens: 2 - no-array-constructor: 2 - no-cond-assign: [2, always] - no-inline-comments: 2 - no-lonely-if: 2 - no-nested-ternary: 2 - no-new-object: 2 - no-trailing-spaces: 2 - no-unneeded-ternary: 2 - operator-assignment: 2 - sort-vars: 2 - space-return-throw-case: 2 - wrap-regex: 2 - - # ECMAScript 6 - arrow-spacing: 2 - constructor-super: 2 - generator-star-spacing: 0 - no-arrow-condition: 2 - no-class-assign: 2 - no-const-assign: 2 - no-dupe-class-members: 2 - no-this-before-super: 2 - no-var: 2 - object-shorthand: 2 - prefer-arrow-callback: 2 - prefer-const: 2 - prefer-spread: 2 - prefer-template: 2 - require-yield: 2 - - # Babel plugin - babel/arrow-parens: [2, always] - babel/generator-star-spacing: [2, after] - - # Legacy - max-depth: 2 - max-params: [2, 4] - no-bitwise: 2 diff --git a/.travis.yml b/.travis.yml index e340b8b..ed43438 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - node + - 4 + - 5 sudo: false diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e403022..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Seegno - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 45081c5..b869cd3 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,10 @@ extends: seegno Add the following `script` to your `package.json`: ```json -scripts: { - "lint": "eslint ." +{ + "scripts": { + "lint": "eslint ." + } } ``` diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6f89871..0000000 --- a/dist/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ - -exports.__esModule = true; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _eslint = require('eslint'); - -var _path = require('path'); - -var _path2 = _interopRequireDefault(_path); - -/** - * Instances. - */ - -var cli = new _eslint.CLIEngine(); -var file = _path2['default'].join(__dirname, '..', '.eslintrc'); - -/** - * Export custom configuration. - */ - -exports['default'] = cli.getConfigForFile(file); -module.exports = exports['default']; \ No newline at end of file diff --git a/package.json b/package.json index 7324c30..ffbd75c 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,13 @@ "name": "eslint-config-seegno", "version": "1.2.1", "description": "Seegno-flavored ESLint config", - "main": "dist/index.js", + "main": "src", "options": { - "mocha": "--compilers js:babel/register --recursive --timeout 5000 --require should test" + "mocha": "--require should test" }, "scripts": { - "build": "rm -rf dist/* && babel src/ --out-dir dist/", "changelog": "github_changelog_generator --header-label='# Changelog'", - "lint": "eslint .", - "prepublish": "npm test && npm run build", + "lint": "eslint --config src/index.js .", "test": "mocha $npm_package_options_mocha" }, "repository": { @@ -29,22 +27,14 @@ "url": "https://github.com/seegno/eslint-config-seegno/issues" }, "homepage": "https://github.com/seegno/eslint-config-seegno#readme", - "dependencies": { - "eslint": "^1.8.0" - }, "devDependencies": { - "babel": "^5.8.23", "babel-eslint": "^4.1.3", + "eslint": "^1.8.0", "eslint-plugin-babel": "^2.1.1", "mocha": "^2.3.3", - "should": "^7.1.0" - }, - "peerDependencies": { - "babel-eslint": ">= 4.1", - "eslint": ">= 1.8", - "eslint-plugin-babel": ">= 2.1" + "should": "^8.0.2" }, "engines": { - "node": ">= 4.0.0" + "node": ">=4" } } diff --git a/src/index.js b/src/index.js index f68c964..ef498cf 100644 --- a/src/index.js +++ b/src/index.js @@ -1,21 +1,157 @@ -'use strict'; /** - * Module dependencies. + * Export `seegno` shared configuration preset. */ -import { CLIEngine } from 'eslint'; -import path from 'path'; - -/** - * Instances. - */ - -const cli = new CLIEngine(); -const file = path.join(__dirname, '..', '.eslintrc'); - -/** - * Export custom configuration. - */ - -export default cli.getConfigForFile(file); +module.exports = { + env: { + es6: true, + mocha: true, + node: true + }, + extends: 'eslint:recommended', + parser: 'babel-eslint', + plugins: ['babel'], + root: true, + rules: { + 'array-bracket-spacing': 0, + 'arrow-parens': 0, + 'block-spacing': 0, + 'brace-style': 0, + 'camelcase': 0, + 'comma-dangle': 0, + 'comma-spacing': 0, + 'comma-style': 0, + 'consistent-return': 0, + 'curly': 0, + 'dot-notation': 0, + 'eol-last': 0, + 'func-names': 0, + 'indent': 0, + 'key-spacing': 0, + 'linebreak-style': 0, + 'lines-around-comment': 0, + 'new-cap': 0, + 'newline-after-var': 0, + 'no-catch-shadow': 0, + 'no-empty-label': 0, + 'no-empty': 0, + 'no-label-var': 0, + 'no-labels': 0, + 'no-mixed-spaces-and-tabs': 0, + 'no-multi-spaces': 0, + 'no-multi-str': 0, + 'no-multiple-empty-lines': 0, + 'no-shadow': 0, + 'no-spaced-func': 0, + 'no-undefined': 0, + 'no-underscore-dangle': 0, + 'no-warning-comments': 0, + 'no-with': 0, + 'object-curly-spacing': 0, + 'one-var': 0, + 'operator-linebreak': 0, + 'padded-blocks': 0, + 'prefer-spread': 2, + 'prefer-template': 2, + 'quote-props': 0, + 'quotes': 0, + 'semi-spacing': 0, + 'semi': 0, + 'space-after-keywords': 0, + 'space-before-blocks': 0, + 'space-before-function-paren': 0, + 'space-in-parens': 0, + 'space-infix-ops': 0, + 'space-unary-ops': 0, + 'spaced-comment': 0, + 'strict': 0, + 'wrap-iife': 0, + 'yoda': 0, + 'no-extra-parens': 2, + 'no-unexpected-multiline': 2, + 'valid-jsdoc': 2, + 'accessor-pairs': 2, + 'block-scoped-var': 2, + 'complexity': [2, 6], + 'default-case': 2, + 'dot-location': [2, 'property'], + 'eqeqeq': [2, 'smart'], + 'no-alert': 2, + 'no-caller': 2, + 'no-div-regex': 2, + 'no-else-return': 2, + 'no-eq-null': 2, + 'no-eval': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-floating-decimal': 2, + 'no-implied-eval': 2, + 'no-iterator': 2, + 'no-lone-blocks': 2, + 'no-loop-func': 2, + 'no-native-reassign': 2, + 'no-new-func': 2, + 'no-new-wrappers': 2, + 'no-new': 2, + 'no-octal-escape': 2, + 'no-process-env': 2, + 'no-proto': 2, + 'no-return-assign': 2, + 'no-script-url': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-throw-literal': 2, + 'no-unused-expressions': 2, + 'no-useless-call': 2, + 'no-useless-concat': 2, + 'no-void': 2, + 'radix': 2, + 'vars-on-top': 2, + 'no-shadow-restricted-names': 2, + 'no-undef-init': 2, + 'no-use-before-define': 2, + 'no-mixed-requires': 2, + 'no-new-require': 2, + 'no-path-concat': 2, + 'no-process-exit': 2, + 'no-restricted-modules': 2, + 'no-sync': 2, + 'computed-property-spacing': 2, + 'consistent-this': 2, + 'func-style': [2, 'declaration', { allowArrowFunctions: true } ], + 'id-length': [2, { exceptions: [ '_', 'e', 'i'] } ], + 'max-nested-callbacks': [2, 4], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-cond-assign': [2, 'always'], + 'no-inline-comments': 2, + 'no-lonely-if': 2, + 'no-nested-ternary': 2, + 'no-new-object': 2, + 'no-trailing-spaces': 2, + 'no-unneeded-ternary': 2, + 'operator-assignment': 2, + 'sort-vars': 2, + 'space-return-throw-case': 2, + 'wrap-regex': 2, + 'arrow-spacing': 2, + 'constructor-super': 2, + 'generator-star-spacing': 0, + 'no-arrow-condition': 2, + 'no-class-assign': 2, + 'no-const-assign': 2, + 'no-dupe-class-members': 2, + 'no-this-before-super': 2, + 'no-var': 2, + 'object-shorthand': 2, + 'prefer-arrow-callback': 2, + 'prefer-const': 2, + 'require-yield': 2, + 'babel/arrow-parens': [2, 'always'], + 'babel/generator-star-spacing': [2, 'before'], + 'max-depth': 2, + 'max-params': [2, 4], + 'no-bitwise': 2 + } + } diff --git a/test/index.js b/test/index.js index 5294eb9..bcfe67f 100644 --- a/test/index.js +++ b/test/index.js @@ -1,20 +1,22 @@ 'use strict'; +/** + * Module dependencies. + */ + +const config = require('../src'); + /** * Tests for `eslint-config-seegno`. */ describe('eslint-config-seegno', () => { it('should load a valid config file', () => { - const config = require('../src'); - config.should.be.an.Object().and.should.not.be.empty(); config.should.containEql(['env', 'extends', 'parser', 'root', 'rules']); }); it('should define the proper environment', () => { - const config = require('../src'); - config.env.should.be.an.Object().and.should.not.be.empty(); config.env.should.containEql(['es6', 'mocha', 'node']); config.env.es6.should.be.true(); @@ -23,28 +25,21 @@ describe('eslint-config-seegno', () => { }); it('should extend `eslint:recommended`', () => { - const config = require('../src'); - config.extends.should.equal('eslint:recommended'); }); it('should use `babel-eslint` as parser', () => { - const config = require('../src'); config.parser.should.equal('babel-eslint'); }); it('should limit the eslint scope to the project only', () => { - const config = require('../src'); - config.root.should.be.true(); }); it('should override some of the inherited rules', () => { - const config = require('../src'); - config.rules.should.be.an.Object().and.should.not.be.empty(); - config.rules['comma-dangle'][0].should.equal(0); + config.rules['comma-dangle'].should.equal(0); config.rules['no-cond-assign'][1].should.equal('always'); config.rules['no-empty'].should.equal(0); });