From 7d601681c1f6be6033049c935e1a032ce521fcb5 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 22 Jun 2020 09:12:43 +0200 Subject: [PATCH] Add some tests --- .eslintrc.js | 1 + .gitignore | 1 + .travis.yml | 17 ++++++++++++----- README.md | 10 +++++++--- index.js | 51 ++++++++++++++++++++++++++------------------------- package.json | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 6 files changed, 93 insertions(+), 36 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..783ee10 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1 @@ +module.exports = require('.') diff --git a/.gitignore b/.gitignore index d8b83df..a4accdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ package-lock.json +node_modules/* diff --git a/.travis.yml b/.travis.yml index 08004ee..5d4a257 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,21 @@ +os: linux +dist: xenial language: node_js -node_js: - - lts/* +# avoid double Travis build when the PR is created on upstream +if: | + type = pull_request OR \ + branch = master OR \ + tag =~ ^v -cache: - directories: - - node_modules +node_js: + - 10 + - 12 + - 14 script: - node -c index.js + - npm run lint deploy: - provider: npm diff --git a/README.md b/README.md index ce4aa39..ee6f825 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,22 @@ This config depends on [Airbnb config](https://github.com/airbnb/javascript). Using NPM: ``` -npm install --save-dev eslint-config-20minutes +npm install --save-dev eslint eslint-config-airbnb eslint-config-20minutes + ``` Using Yarn: ``` -yarn add --dev eslint-config-20minutes +yarn add --dev eslint eslint-config-airbnb eslint-config-20minutes ``` Update your `.eslintrc`: ```js { - "extends": "20minutes" + "extends": "20minutes", + "rules": { + // Additional, per-project rules... + } } ``` diff --git a/index.js b/index.js index a914547..1b92c6e 100644 --- a/index.js +++ b/index.js @@ -1,32 +1,33 @@ module.exports = { - "env": { - "es6": true, - "node": true, - "jest": true, - "browser": true, + env: { + es6: true, + node: true, + jest: true, + browser: true, }, - "parser": "babel-eslint", - "extends": "airbnb", - "plugins": [ - "babel", + parser: 'babel-eslint', + extends: 'airbnb', + plugins: [ + 'babel', + 'react', ], - "rules": { - "semi": [2, "never"], - "no-console": [1, { - "allow": ["warn", "error"], + rules: { + semi: [2, 'never'], + 'no-console': [1, { + allow: ['warn', 'error'], }], - "curly": [1, "all"], - "no-param-reassign": [1, { - "props": false, + curly: [1, 'all'], + 'no-param-reassign': [1, { + props: false, }], - "import/prefer-default-export": 0, - "no-multiple-empty-lines": [1, { "max": 1, "maxEOF": 1, "maxBOF": 0 }], - "padding-line-between-statements": [ - "error", - { "blankLine": "always", "prev": "*", "next": "return" }, - { "blankLine": "always", "prev": "import", "next": "*" }, - { "blankLine": "never", "prev": "import", "next": "import" }, + 'import/prefer-default-export': 0, + 'no-multiple-empty-lines': [1, { max: 1, maxEOF: 1, maxBOF: 0 }], + 'padding-line-between-statements': [ + 'error', + { blankLine: 'always', prev: '*', next: 'return' }, + { blankLine: 'always', prev: 'import', next: '*' }, + { blankLine: 'never', prev: 'import', next: 'import' }, ], - "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], - } + 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], + }, } diff --git a/package.json b/package.json index dcc59af..2083f7a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,50 @@ { "name": "eslint-config-20minutes", - "version": "1.0.8", + "version": "1.0.9", + "description": "ESLint shareable config for 20 Minutes", + "license": "MIT", + "devDependencies": { + "babel-eslint": "^10.0", + "eslint-plugin-babel": "^5.0", + "eslint": "^5.16.0 || ^6.8.0 || <7.3.0", + "eslint-plugin-import": "^2.21.2", + "eslint-plugin-react": "^7.20.0", + "eslint-plugin-jsx-a11y": "^6.3.0", + "eslint-plugin-react-hooks": "^1.7.0 || ^2.3.0 || ^3 || ^4", + "eslint-config-airbnb": ">=16.0.0" + }, "peerDependencies": { - "eslint-config-airbnb": ">16.0.0" - } + "eslint-config-airbnb": ">=16.0.0" + }, + "repository": "20minutes/eslint-config", + "engines": { + "node": ">=10.13.0" + }, + "scripts": { + "test": "node -c index.js", + "lint": "eslint index.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "20minutes", + "code", + "quality", + "style", + "lint", + "linter", + "jscs", + "jshint", + "jslint", + "eslint", + "validate", + "code style", + "strict", + "check", + "checker", + "verify", + "enforce", + "hint" + ] }