diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0f17867 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5f19d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +package-lock.json diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..c1ca392 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock = false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..210f9d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: node_js +node_js: + - "11" + - "10" + - "9" + - "8" + - "7" + - "6" +cache: npm +before_install: + - nvm install-latest-npm +script: + - npm run lint + - npm test +jobs: + include: + - stage: deploying to npm + node_js: "11" + script: echo "Deploying to npm ..." + deploy: + provider: npm + email: $NPM_EMAIL + api_key: $NPM_API_KEY + on: + branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f3cfe12 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 0.1.0 - 2019-03-24 +### Added +- ESLint shareable config. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..314545f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jason Nam + +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 new file mode 100644 index 0000000..878f4f5 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# eslint-config-standardpress + +[![npm version](https://img.shields.io/npm/v/eslint-config-standardpress.svg)](https://npmjs.com/package/eslint-config-standardpress) +[![travis-ci build status](https://travis-ci.com/standardpress/eslint-config-standardpress.svg?branch=master)](https://travis-ci.com/standardpress/eslint-config-standardpress) +[![appveyor build status](https://ci.appveyor.com/api/projects/status/vxlwmo9yy5y3lh04/branch/master?svg=true)](https://ci.appveyor.com/project/jasonnam/eslint-config-standardpress/branch/master) + +ESLint shareable config by StandardPress. + +## Installation + +### install-peerdeps + +Install with [`install-peerdeps`](https://npmjs.com/package/install-peerdeps): + +```sh +npx install-peerdeps --dev eslint-config-standardpress +``` + +### npm + +Install with npm: + +```sh +npm install --save-dev eslint-config-standardpress +``` + +Next, install the correct versions of each package, which are listed by the command: + +```sh +npm info "eslint-config-standardpress@latest" peerDependencies +``` + +## Usage + +Extend ESLint config with `standardpress`. + +```json +{ + "extends": "standardpress" +} +``` + +## License + +eslint-config-standardpress is released under the MIT license. [See LICENSE](https://github.com/standardpress/eslint-config-standardpress/blob/master/LICENSE) for details. diff --git a/__tests__/index.test.js b/__tests__/index.test.js new file mode 100644 index 0000000..8d48b84 --- /dev/null +++ b/__tests__/index.test.js @@ -0,0 +1,12 @@ +'use strict'; + +const CLIEngine = require('eslint').CLIEngine; + +test('all rules are configured correctly', () => { + const cli = new CLIEngine({ + useEslintrc: false, + configFile: 'index.js' + }); + + expect(cli.executeOnText('var foo\n')).toBeTruthy(); +}); diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..72ceb3d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +environment: + matrix: + - nodejs_version: "6" + - nodejs_version: "7" + - nodejs_version: "8" + - nodejs_version: "9" + - nodejs_version: "10" + - nodejs_version: "11" +platform: + - x86 + - x64 +cache: + - node_modules +install: + - ps: Install-Product node $env:nodejs_version $env:platform + - npm install npm --global + - npm install +build: off +test_script: + - node --version + - npm --version + - npm run lint + - npm test +deploy: off diff --git a/index.js b/index.js new file mode 100644 index 0000000..e726709 --- /dev/null +++ b/index.js @@ -0,0 +1,112 @@ +'use strict'; + +module.exports = { + 'extends': [ + 'eslint:recommended', + 'plugin:eslint-comments/recommended', + 'plugin:node/recommended', + 'plugin:jest/recommended', + 'plugin:jest/style' + ], + 'plugins': [ + 'sort-requires' + ], + 'rules': { + 'arrow-spacing': 'error', + 'eqeqeq': 'error', + 'eslint-comments/no-unused-disable': 'error', + 'no-use-before-define': [ + 'error', + 'nofunc' + ], + 'no-var': 'error', + 'node/exports-style': [ + 'error', + 'module.exports' + ], + 'object-shorthand': 'error', + 'one-var': [ + 'error', + 'never' + ], + 'padding-line-between-statements': [ + 'error', + { + 'blankLine': 'always', + 'prev': 'directive', + 'next': '*' + }, + { + 'blankLine': 'never', + 'prev': 'directive', + 'next': 'directive' + }, + { + 'blankLine': 'always', + 'prev': [ + 'const', + 'let', + 'var' + ], + 'next': '*' + }, + { + 'blankLine': 'any', + 'prev': [ + 'const', + 'let', + 'var' + ], + 'next': [ + 'const', + 'let', + 'var' + ] + }, + { + 'blankLine': 'always', + 'prev': '*', + 'next': 'return' + }, + { + 'blankLine': 'always', + 'prev': '*', + 'next': [ + 'for', + 'function', + 'if', + 'switch', + 'try' + ] + }, + { + 'blankLine': 'always', + 'prev': [ + 'for', + 'function', + 'if', + 'switch', + 'try' + ], + 'next': '*' + } + ], + 'prefer-const': 'error', + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always', + { + 'omitLastInOneLineBlock': true + } + ], + 'sort-requires/sort-requires': 'error', + 'strict': [ + 'error', + 'global' + ] + } +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..70df1f0 --- /dev/null +++ b/package.json @@ -0,0 +1,48 @@ +{ + "name": "eslint-config-standardpress", + "description": "ESLint shareable config by StandardPress.", + "license": "MIT", + "author": "Jason Nam (https://jasonnam.com)", + "homepage": "https://github.com/standardpress/eslint-config-standardpress", + "repository": { + "type": "git", + "url": "https://github.com/standardpress/eslint-config-standardpress" + }, + "bugs": { + "url": "https://github.com/standardpress/eslint-config-standardpress/issues" + }, + "version": "0.1.0", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "lint": "eslint -c index.js index.js __tests__", + "test": "jest" + }, + "peerDependencies": { + "eslint": "^5.15.3", + "eslint-plugin-eslint-comments": "^3.1.1", + "eslint-plugin-jest": "^22.4.1", + "eslint-plugin-node": "^8.0.1", + "eslint-plugin-sort-requires": "^2.1.0" + }, + "devDependencies": { + "eslint": "^5.15.3", + "eslint-plugin-eslint-comments": "^3.1.1", + "eslint-plugin-jest": "^22.4.1", + "eslint-plugin-node": "^8.0.1", + "eslint-plugin-sort-requires": "^2.1.0", + "jest": "^24.5.0" + }, + "keywords": [ + "config", + "eslint", + "eslint-config", + "lint", + "standardpress" + ], + "engines": { + "node": ">=6.14" + } +}