├── .yarnrc ├── packages ├── eslint-config-babel │ ├── .npmignore │ ├── test │ │ └── fixtures │ │ │ └── index.js │ ├── babel-module.js │ ├── index.js │ ├── package.json │ └── README.md ├── eslint-config-react │ ├── .npmignore │ ├── test │ │ └── fixtures │ │ │ ├── index.js │ │ │ └── native.js │ ├── babel-react-require.js │ ├── index.js │ ├── package.json │ ├── native.js │ ├── README.md │ └── base.js ├── eslint-config-typescript │ ├── .npmignore │ ├── test │ │ └── fixtures │ │ │ ├── index.js │ │ │ ├── react.js │ │ │ └── react-native.js │ ├── react.js │ ├── react-native.js │ ├── package.json │ ├── README.md │ └── index.js └── eslint-config │ ├── .npmignore │ ├── test │ └── fixtures │ │ ├── jest.js │ │ ├── ramda.js │ │ └── lodash.js │ ├── ramda.js │ ├── lodash.js │ ├── script.js │ ├── jest.js │ ├── package.json │ ├── README.md │ └── index.js ├── .eslintignore ├── .eslintrc.js ├── .vscode ├── extensions.json └── settings.json ├── .gitignore ├── .editorconfig ├── README.md ├── .travis.yml ├── LICENSE └── package.json /.yarnrc: -------------------------------------------------------------------------------- 1 | workspaces-experimental true 2 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/.npmignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | /*.log 3 | -------------------------------------------------------------------------------- /packages/eslint-config-react/.npmignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | /*.log 3 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/.npmignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | /*.log 3 | -------------------------------------------------------------------------------- /packages/eslint-config/.npmignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | /rules/__tests__/ 3 | /*.log 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /* 2 | !/packages 3 | /packages/*/node_modules 4 | !/scripts 5 | !/*.js 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '@anvilabs/eslint-config/script'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config/test/fixtures/jest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['../../index.js', '../../jest.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config/test/fixtures/ramda.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['../../index.js', '../../ramda.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config/ramda.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['plugin:ramda/recommended'], 3 | plugins: ['ramda'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/eslint-config/test/fixtures/lodash.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['../../index.js', '../../lodash.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/test/fixtures/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '../../index.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config-react/test/fixtures/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '../../index.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config/lodash.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['plugin:lodash-fp/recommended'], 3 | plugins: ['lodash-fp'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/eslint-config-react/test/fixtures/native.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '../../native.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/test/fixtures/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '../../index.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/test/fixtures/react.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@anvilabs/eslint-config', '../../index.js', '../../react.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/babel-module.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | 'import/resolver': { 4 | 'babel-module': {}, 5 | }, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "EditorConfig.editorconfig", 5 | "esbenp.prettier-vscode" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS 2 | # 3 | .DS_Store 4 | 5 | # Node.js 6 | # 7 | node_modules/ 8 | npm-debug.log 9 | yarn-error.log 10 | 11 | # ESLint 12 | # 13 | /.eslintcache 14 | 15 | -------------------------------------------------------------------------------- /packages/eslint-config-react/babel-react-require.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'react/jsx-uses-react': 'off', 4 | 'react/react-in-jsx-scope': 'off', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/test/fixtures/react-native.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | '@anvilabs/eslint-config', 4 | '../../index.js', 5 | '../../react-native.js', 6 | ], 7 | }; 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /packages/eslint-config/script.js: -------------------------------------------------------------------------------- 1 | // primarily used for config files in the root or in scripts 2 | module.exports = { 3 | rules: { 4 | 'global-require': 'off', 5 | 'no-console': 'off', 6 | // https://github.com/benmosher/eslint-plugin-import 7 | 'import/no-extraneous-dependencies': 'off', 8 | 'import/no-internal-modules': 'off', 9 | // https://github.com/sindresorhus/eslint-plugin-unicorn 10 | 'unicorn/no-process-exit': 'off', 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": false, 3 | "editor.insertSpaces": true, 4 | "editor.rulers": [80], 5 | "editor.tabSize": 2, 6 | "[javascript]": { 7 | "editor.formatOnSave": true 8 | }, 9 | "[json]": { 10 | "editor.formatOnSave": true 11 | }, 12 | "[yaml]": { 13 | "editor.formatOnSave": true 14 | }, 15 | 16 | "eslint.autoFixOnSave": true, 17 | 18 | "files.autoSave": "off", 19 | "files.exclude": { 20 | ".eslintcache": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @anvilabs/eslint-config 2 | 3 | [![Build Status](https://img.shields.io/travis/anvilabs/eslint-config.svg)](https://travis-ci.org/anvilabs/eslint-config) 4 | [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) 5 | 6 | Anvilabs' ESLint configs, following our internal styleguide. See individual packages in [packages](./packages/). 7 | 8 | ## License 9 | 10 | [MIT License](./LICENSE) © Anvilabs LLC 11 | -------------------------------------------------------------------------------- /packages/eslint-config-react/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['./base.js', 'plugin:jsx-a11y/recommended'], 3 | plugins: ['jsx-a11y'], 4 | env: { 5 | browser: true, 6 | }, 7 | settings: { 8 | 'import/resolver': { 9 | node: { 10 | extensions: ['.js', '.jsx', '.web.js', '.web.jsx', '.json'], 11 | }, 12 | }, 13 | }, 14 | rules: { 15 | // https://github.com/benmosher/eslint-plugin-import 16 | 'import/extensions': [ 17 | 'error', 18 | 'always', 19 | { 20 | js: 'never', 21 | jsx: 'never', 22 | 'web.js': 'never', 23 | 'web.jsx': 'never', 24 | }, 25 | ], 26 | // https://github.com/evcohen/eslint-plugin-jsx-a11y 27 | 'jsx-a11y/lang': 'error', 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['babel'], 3 | parser: 'babel-eslint', 4 | rules: { 5 | // https://github.com/babel/eslint-plugin-babel 6 | 'babel/array-bracket-spacing': 'off', 7 | 'babel/arrow-parens': 'off', 8 | camelcase: 'off', 9 | 'babel/camelcase': ['error', {properties: 'never'}], 10 | 'babel/flow-object-type': 'off', 11 | 'babel/func-params-comma-dangle': 'off', 12 | 'babel/generator-star-spacing': 'off', 13 | 'babel/new-cap': 'off', 14 | 'babel/no-await-in-loop': 'off', 15 | 'babel/no-invalid-this': 'error', 16 | 'no-unused-expressions': 'off', 17 | 'babel/no-unused-expressions': ['error', {allowShortCircuit: true}], 18 | 'babel/object-curly-spacing': 'off', 19 | 'babel/object-shorthand': 'off', 20 | 'babel/quotes': 'off', 21 | 'babel/semi': 'off', 22 | 'babel/valid-typeof': 'error', 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '10' 4 | cache: 5 | yarn: true 6 | directories: 7 | - node_modules 8 | branches: 9 | only: 10 | - master 11 | notifications: 12 | email: false 13 | slack: 14 | on_pull_requests: false 15 | secure: NNoU8uh0rzaSnStMrI6+aQtcZTtwpJ3DTmu6mdGrRZviLqTOeBcpgVTPWjueuHJ3XJujCQOtZzF/4MrA51xRDQHF68Tfnue7SsQS1ksLLJSy/jPCCc7fiqZcSGYNwCvSEd1sgAYIbFGiKArEmzmCUmcUCWlIBz+UfCbIDCKBxx4skBHdVjVJ5Ju/EtJVWof2S84EcvLRG3HtUCapWvS+o9znjO0RYY1Sa1Qe7JUoMsS3QIV69eZ6abGS+N80i3EJ/gasfeMTPXPnm3OiVcaiABlHyezyrizTSIkE77/qXTwJUjLpVbHNm5gahcouTwlNS/wV6chX+iRirkeHj5lzTTGHD7UdXwv+VgvYKp83D0EwxUYXG/7iKTUijVddMW2xtE53Nk/+DS1zYXCwhKubRO+Fg5yKuhXOR8xGXqd+rJ0RXxDxu9VNTZhfSWVMFyvKEma4dzgUBjuPUUDq4dsu6IsrAMQ+InAdwcqutKJdaXFl2iRyvEmKDLBd9SjisWyxGBBk4kIN6tx5+eRXLf9pVBnXV105HquMa7uY6t/qUVwKTNEc6hCRPMRBR+JLAvdHqlZecFHja28KH1V5OaZH/phuqqILxYzeIyahvWN8UnLH9dBt/vJZQmyoyJTg1/PoFqFOYSGUSodi49LDODXuSq1lJP4zLJxpwrKbJ1AKYjo= 16 | script: 17 | - yarn test 18 | after_success: 19 | - yarn run semantic-release 20 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/react.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | 'import/resolver': { 4 | typescript: { 5 | directory: process.cwd(), 6 | extensions: [ 7 | '.js', 8 | '.jsx', 9 | '.web.js', 10 | '.web.jsx', 11 | '.ts', 12 | '.tsx', 13 | '.web.ts', 14 | '.web.tsx', 15 | '.json', 16 | ], 17 | }, 18 | }, 19 | 'import/extensions': ['.js', 'jsx', '.ts', '.tsx'], 20 | }, 21 | rules: { 22 | // https://github.com/benmosher/eslint-plugin-import 23 | 'import/extensions': [ 24 | 'error', 25 | 'always', 26 | { 27 | js: 'never', 28 | jsx: 'never', 29 | 'web.js': 'never', 30 | 'web.jsx': 'never', 31 | ts: 'never', 32 | tsx: 'never', 33 | 'web.ts': 'never', 34 | 'web.tsx': 'never', 35 | }, 36 | ], 37 | // https://github.com/yannickcr/eslint-plugin-react 38 | 'react/jsx-filename-extension': ['error', {extensions: ['.tsx']}], 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Anvilabs, LLC (https://anvilabs.co) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anvilabs/eslint-config-babel", 3 | "version": "0.0.0-development", 4 | "description": "Anvilabs' ESLint config for our Babel codebases", 5 | "keywords": [ 6 | "eslint", 7 | "eslint config", 8 | "config", 9 | "anvilabs", 10 | "styleguide" 11 | ], 12 | "repository": "anvilabs/eslint-config", 13 | "homepage": "https://github.com/anvilabs/eslint-config#readme", 14 | "bugs": { 15 | "url": "https://github.com/anvilabs/eslint-config/issues" 16 | }, 17 | "license": "MIT", 18 | "author": { 19 | "name": "Ayan Yenbekbay", 20 | "email": "ayan.yenb@gmail.com", 21 | "url": "https://yenbekbay.me" 22 | }, 23 | "engines": { 24 | "node": ">=6.0.0" 25 | }, 26 | "main": "index.js", 27 | "scripts": { 28 | "find-new-rules:index": "eslint-find-rules --unused test/fixtures/index.js", 29 | "find-new-rules": "run-p --silent find-new-rules:*", 30 | "semantic-release": "semantic-release" 31 | }, 32 | "release": { 33 | "extends": "semantic-release-monorepo" 34 | }, 35 | "peerDependencies": { 36 | "@anvilabs/eslint-config": "*" 37 | }, 38 | "dependencies": { 39 | "babel-eslint": "^10.0.1", 40 | "eslint-plugin-babel": "^5.3.0" 41 | }, 42 | "devDependencies": {} 43 | } 44 | -------------------------------------------------------------------------------- /packages/eslint-config-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anvilabs/eslint-config-react", 3 | "version": "0.0.0-development", 4 | "description": "Anvilabs' ESLint config for our React/React Native apps", 5 | "keywords": [ 6 | "eslint", 7 | "eslint config", 8 | "config", 9 | "anvilabs", 10 | "styleguide" 11 | ], 12 | "repository": "anvilabs/eslint-config", 13 | "homepage": "https://github.com/anvilabs/eslint-config#readme", 14 | "bugs": { 15 | "url": "https://github.com/anvilabs/eslint-config/issues" 16 | }, 17 | "license": "MIT", 18 | "author": { 19 | "name": "Ayan Yenbekbay", 20 | "email": "ayan.yenb@gmail.com", 21 | "url": "https://yenbekbay.me" 22 | }, 23 | "engines": { 24 | "node": ">=6.0.0" 25 | }, 26 | "main": "index.js", 27 | "scripts": { 28 | "find-new-rules:index": "eslint-find-rules --unused test/fixtures/index.js", 29 | "find-new-rules:native": "eslint-find-rules --unused test/fixtures/native.js", 30 | "find-new-rules": "run-p --silent find-new-rules:*", 31 | "semantic-release": "semantic-release" 32 | }, 33 | "release": { 34 | "extends": "semantic-release-monorepo" 35 | }, 36 | "peerDependencies": { 37 | "@anvilabs/eslint-config": "*" 38 | }, 39 | "dependencies": { 40 | "eslint-plugin-jsx-a11y": "^6.2.1", 41 | "eslint-plugin-react": "^7.12.4", 42 | "eslint-plugin-react-native": "^3.6.0" 43 | }, 44 | "devDependencies": {} 45 | } 46 | -------------------------------------------------------------------------------- /packages/eslint-config-react/native.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['./base.js'], 3 | plugins: ['react-native'], 4 | globals: { 5 | 'react-native/react-native': true, 6 | }, 7 | settings: { 8 | 'import/resolver': { 9 | node: { 10 | extensions: [ 11 | '.js', 12 | '.jsx', 13 | '.ios.js', 14 | '.ios.jsx', 15 | '.android.js', 16 | '.android.jsx', 17 | '.native.js', 18 | '.native.jsx', 19 | '.json', 20 | ], 21 | }, 22 | }, 23 | }, 24 | rules: { 25 | 'no-console': 'off', 26 | // https://github.com/benmosher/eslint-plugin-import 27 | 'import/extensions': [ 28 | 'error', 29 | 'always', 30 | { 31 | js: 'never', 32 | jsx: 'never', 33 | 'ios.js': 'never', 34 | 'ios.jsx': 'never', 35 | 'android.js': 'never', 36 | 'android.jsx': 'never', 37 | 'native.js': 'never', 38 | 'native.jsx': 'never', 39 | }, 40 | ], 41 | // https://github.com/Intellicode/eslint-plugin-react-native 42 | 'react-native/no-color-literals': 'error', 43 | 'react-native/no-inline-styles': 'error', 44 | 'react-native/no-raw-text': 'off', // buggy (https://github.com/Intellicode/eslint-plugin-react-native/issues/210) 45 | 'react-native/no-unused-styles': 'error', 46 | 'react-native/sort-styles': 'off', 47 | 'react-native/split-platform-components': 'error', 48 | }, 49 | }; 50 | -------------------------------------------------------------------------------- /packages/eslint-config/jest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['jest'], 3 | env: { 4 | jest: true, 5 | }, 6 | rules: { 7 | 'max-nested-callbacks': 'off', 8 | // https://github.com/benmosher/eslint-plugin-import 9 | 'import/no-extraneous-dependencies': 'off', 10 | // https://github.com/jest-community/eslint-plugin-jest 11 | 'jest/consistent-test-it': ['error', {fn: 'test', withinDescribe: 'it'}], 12 | 'jest/expect-expect': 'error', 13 | 'jest/lowercase-name': 'off', 14 | 'jest/no-alias-methods': 'error', 15 | 'jest/no-disabled-tests': 'warn', 16 | 'jest/no-focused-tests': 'error', 17 | 'jest/no-hooks': 'off', 18 | 'jest/no-identical-title': 'error', 19 | 'jest/no-jasmine-globals': 'error', 20 | 'jest/no-jest-import': 'error', 21 | 'jest/no-large-snapshots': 'off', 22 | 'jest/no-test-callback': 'error', 23 | 'jest/no-test-prefixes': 'error', 24 | 'jest/no-test-return-statement': 'error', 25 | 'jest/no-truthy-falsy': 'error', 26 | 'jest/prefer-expect-assertions': 'off', 27 | 'jest/prefer-inline-snapshots': 'off', 28 | 'jest/prefer-spy-on': 'error', 29 | 'jest/prefer-strict-equal': 'error', 30 | 'jest/prefer-to-be-null': 'error', 31 | 'jest/prefer-to-be-undefined': 'error', 32 | 'jest/prefer-to-contain': 'error', 33 | 'jest/prefer-to-have-length': 'error', 34 | 'jest/prefer-todo': 'error', 35 | 'jest/require-tothrow-message': 'error', 36 | 'jest/valid-describe': 'error', 37 | 'jest/valid-expect-in-promise': 'error', 38 | 'jest/valid-expect': 'error', 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/react-native.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | 'import/resolver': { 4 | typescript: { 5 | directory: process.cwd(), 6 | extensions: [ 7 | '.js', 8 | '.jsx', 9 | '.ios.js', 10 | '.ios.jsx', 11 | '.android.js', 12 | '.android.jsx', 13 | '.native.js', 14 | '.native.jsx', 15 | '.ts', 16 | '.tsx', 17 | '.ios.ts', 18 | '.ios.tsx', 19 | '.android.ts', 20 | '.android.tsx', 21 | '.native.ts', 22 | '.native.tsx', 23 | '.json', 24 | ], 25 | }, 26 | }, 27 | 'import/extensions': ['.js', 'jsx', '.ts', '.tsx'], 28 | }, 29 | rules: { 30 | // https://github.com/benmosher/eslint-plugin-import 31 | 'import/extensions': [ 32 | 'error', 33 | 'always', 34 | { 35 | js: 'never', 36 | jsx: 'never', 37 | 'ios.js': 'never', 38 | 'ios.jsx': 'never', 39 | 'android.js': 'never', 40 | 'android.jsx': 'never', 41 | 'native.js': 'never', 42 | 'native.jsx': 'never', 43 | ts: 'never', 44 | tsx: 'never', 45 | 'ios.ts': 'never', 46 | 'ios.tsx': 'never', 47 | 'android.ts': 'never', 48 | 'android.tsx': 'never', 49 | 'native.ts': 'never', 50 | 'native.tsx': 'never', 51 | }, 52 | ], 53 | // https://github.com/yannickcr/eslint-plugin-react 54 | 'react/jsx-filename-extension': ['error', {extensions: ['.tsx']}], 55 | }, 56 | }; 57 | -------------------------------------------------------------------------------- /packages/eslint-config-babel/README.md: -------------------------------------------------------------------------------- 1 | # @anvilabs/eslint-config-babel 2 | 3 | [![Version](https://img.shields.io/npm/v/@anvilabs/eslint-config-babel.svg)](http://npm.im/@anvilabs/eslint-config-babel) 4 | [![Dependency Status](https://david-dm.org/anvilabs/eslint-config/status.svg?path=packages/eslint-config-babel)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-babel) 5 | [![devDependency Status](https://david-dm.org/anvilabs/eslint-config/dev-status.svg?path=packages/eslint-config-babel)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-babel&type=dev) 6 | 7 | Anvilabs' ESLint config for our Babel codebases. 8 | 9 | ## Usage 10 | 11 | This config relies dangerously on npm@3/yarn flatter tree for its dependencies (because of [eslint/issues/3458](https://github.com/eslint/eslint/issues/3458)), so installation may be as simple as: 12 | 13 | ```bash 14 | $ yarn add eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-babel --dev 15 | # or 16 | $ npm install eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-babel --save-dev 17 | ``` 18 | 19 | Then add the extends to your `.eslintrc.js`: 20 | 21 | ```js 22 | module.exports = { 23 | extends: ['@anvilabs/eslint-config', '@anvilabs/eslint-config-babel' /* and maybe '@anvilabs/eslint-config-babel/babel-module' */], 24 | rules: { 25 | // your overrides 26 | }, 27 | }; 28 | ``` 29 | 30 | Additional configs include: 31 | 32 | - `'@anvilabs/eslint-config-babel/babel-module'` for usage with [babel-plugin-module-resolver](https://github.com/tleunen/babel-plugin-module-resolver) 33 | 34 | ## License 35 | 36 | [MIT License](../../LICENSE) © Anvilabs LLC 37 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anvilabs/eslint-config-typescript", 3 | "version": "0.0.0-development", 4 | "description": "Anvilabs' ESLint config for our Typescript codebases", 5 | "keywords": [ 6 | "eslint", 7 | "eslint config", 8 | "config", 9 | "anvilabs", 10 | "styleguide" 11 | ], 12 | "repository": "anvilabs/eslint-config", 13 | "homepage": "https://github.com/anvilabs/eslint-config#readme", 14 | "bugs": { 15 | "url": "https://github.com/anvilabs/eslint-config/issues" 16 | }, 17 | "license": "MIT", 18 | "author": { 19 | "name": "Ayan Yenbekbay", 20 | "email": "ayan.yenb@gmail.com", 21 | "url": "https://yenbekbay.me" 22 | }, 23 | "engines": { 24 | "node": ">=6.0.0" 25 | }, 26 | "main": "index.js", 27 | "scripts": { 28 | "find-new-rules:base": "eslint-find-rules --unused test/fixtures/index.js", 29 | "find-new-rules:react": "eslint-find-rules --unused test/fixtures/react.js", 30 | "find-new-rules:react-native": "eslint-find-rules --unused test/fixtures/react-native.js", 31 | "find-new-rules": "exit 0; run-p --silent find-new-rules:*", 32 | "semantic-release": "semantic-release" 33 | }, 34 | "release": { 35 | "extends": "semantic-release-monorepo" 36 | }, 37 | "peerDependencies": { 38 | "@anvilabs/eslint-config": "*", 39 | "typescript": "*" 40 | }, 41 | "dependencies": { 42 | "@typescript-eslint/eslint-plugin": "^1.3.0", 43 | "@typescript-eslint/parser": "^1.3.0", 44 | "eslint-import-resolver-typescript": "^1.1.1", 45 | "eslint-plugin-import": "^2.16.0" 46 | }, 47 | "devDependencies": { 48 | "typescript": "^3.3.3" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/eslint-config-react/README.md: -------------------------------------------------------------------------------- 1 | # @anvilabs/eslint-config-react 2 | 3 | [![Version](https://img.shields.io/npm/v/@anvilabs/eslint-config-react.svg)](http://npm.im/@anvilabs/eslint-config-react) 4 | [![Dependency Status](https://david-dm.org/anvilabs/eslint-config/status.svg?path=packages/eslint-config-react)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-react) 5 | [![devDependency Status](https://david-dm.org/anvilabs/eslint-config/dev-status.svg?path=packages/eslint-config-react)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-react&type=dev) 6 | 7 | Anvilabs' ESLint config for our React/React Native apps. 8 | 9 | ## Usage 10 | 11 | This config relies dangerously on npm@3/yarn flatter tree for its dependencies (because of [eslint/issues/3458](https://github.com/eslint/eslint/issues/3458)), so installation may be as simple as: 12 | 13 | ```bash 14 | $ yarn add eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-react --dev 15 | # or 16 | $ npm install eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-react --save-dev 17 | ``` 18 | 19 | Then add the extends to your `.eslintrc.js`: 20 | 21 | ```js 22 | module.exports = { 23 | extends: ['@anvilabs/eslint-config', '@anvilabs/eslint-config-react' /* or '@anvilabs/eslint-config-react/native' */], 24 | rules: { 25 | // your overrides 26 | }, 27 | }; 28 | ``` 29 | 30 | Additional configs include: 31 | 32 | - `'@anvilabs/eslint-config-typescript/babel-react-require'` for the import plugin to work with [babel-plugin-module-resolver](https://github.com/tleunen/babel-plugin-module-resolver) 33 | 34 | ## License 35 | 36 | [MIT License](../../LICENSE) © Anvilabs LLC 37 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/README.md: -------------------------------------------------------------------------------- 1 | # @anvilabs/eslint-config-typescript 2 | 3 | [![Version](https://img.shields.io/npm/v/@anvilabs/eslint-config-typescript.svg)](http://npm.im/@anvilabs/eslint-config-typescript) 4 | [![Dependency Status](https://david-dm.org/anvilabs/eslint-config/status.svg?path=packages/eslint-config-typescript)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-typescript) 5 | [![devDependency Status](https://david-dm.org/anvilabs/eslint-config/dev-status.svg?path=packages/eslint-config-typescript)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config-typescript&type=dev) 6 | 7 | Anvilabs' ESLint config for our Typescript codebases. 8 | 9 | ## Usage 10 | 11 | This config relies dangerously on npm@3/yarn flatter tree for its dependencies (because of [eslint/issues/3458](https://github.com/eslint/eslint/issues/3458)), so installation may be as simple as: 12 | 13 | ```bash 14 | $ yarn add eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-typescript --dev 15 | # or 16 | $ npm install eslint prettier @anvilabs/eslint-config @anvilabs/eslint-config-typescript --save-dev 17 | ``` 18 | 19 | Then add the extends to your `.eslintrc.js`: 20 | 21 | ```js 22 | module.exports = { 23 | extends: ['@anvilabs/eslint-config', '@anvilabs/eslint-config-typescript' /* and maybe '@anvilabs/eslint-config-typescript/react' or '@anvilabs/eslint-config-typescript/react-native' */], 24 | rules: { 25 | // your overrides 26 | }, 27 | }; 28 | ``` 29 | 30 | Additional configs include: 31 | 32 | - `'@anvilabs/eslint-config-typescript/react'` for usage with [React](https://reactjs.org/) 33 | - `'@anvilabs/eslint-config-typescript/react-native'` for usage with [React Native](https://facebook.github.io/react-native/) 34 | 35 | ## License 36 | 37 | [MIT License](../../LICENSE) © Anvilabs LLC 38 | -------------------------------------------------------------------------------- /packages/eslint-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anvilabs/eslint-config", 3 | "version": "0.0.0-development", 4 | "description": "Anvilabs' base ESLint config", 5 | "keywords": [ 6 | "eslint", 7 | "eslint config", 8 | "config", 9 | "anvilabs", 10 | "styleguide" 11 | ], 12 | "repository": "anvilabs/eslint-config", 13 | "homepage": "https://github.com/anvilabs/eslint-config#readme", 14 | "bugs": { 15 | "url": "https://github.com/anvilabs/eslint-config/issues" 16 | }, 17 | "license": "MIT", 18 | "author": { 19 | "name": "Ayan Yenbekbay", 20 | "email": "ayan.yenb@gmail.com", 21 | "url": "https://yenbekbay.me" 22 | }, 23 | "engines": { 24 | "node": ">=6.0.0" 25 | }, 26 | "main": "index.js", 27 | "scripts": { 28 | "find-new-rules:base": "eslint-find-rules --unused index.js", 29 | "find-new-rules:jest": "eslint-find-rules --unused test/fixtures/jest.js", 30 | "find-new-rules:lodash": "eslint-find-rules --unused test/fixtures/lodash.js", 31 | "find-new-rules:ramda": "eslint-find-rules --unused test/fixtures/ramda.js", 32 | "find-new-rules": "run-p --silent find-new-rules:*", 33 | "semantic-release": "semantic-release" 34 | }, 35 | "release": { 36 | "extends": "semantic-release-monorepo" 37 | }, 38 | "peerDependencies": { 39 | "eslint": "^5.7.0", 40 | "prettier": ">= 0.11.0" 41 | }, 42 | "dependencies": { 43 | "eslint-config-airbnb-base": "^13.1.0", 44 | "eslint-config-prettier": "^4.0.0", 45 | "eslint-plugin-eslint-comments": "^3.1.0", 46 | "eslint-plugin-import": "^2.16.0", 47 | "eslint-plugin-jest": "^22.2.2", 48 | "eslint-plugin-lodash-fp": "^2.2.0-a1", 49 | "eslint-plugin-no-use-extend-native": "^0.4.0", 50 | "eslint-plugin-promise": "^4.0.1", 51 | "eslint-plugin-ramda": "^2.5.1", 52 | "eslint-plugin-sort-imports-es6-autofix": "^0.3.0", 53 | "eslint-plugin-unicorn": "^7.1.0" 54 | }, 55 | "devDependencies": {} 56 | } 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@anvilabs/eslint-config", 3 | "private": true, 4 | "repository": "anvilabs/eslint-config", 5 | "license": "MIT", 6 | "engines": { 7 | "node": ">=6.0.0" 8 | }, 9 | "workspaces": [ 10 | "packages/*" 11 | ], 12 | "scripts": { 13 | "lint": "eslint --cache .", 14 | "lint.fix": "yarn run lint --fix", 15 | "find-new-rules": "wsrun --fast-exit find-new-rules", 16 | "prettier-check": "eslint --print-config packages/eslint-config/index.js | eslint-config-prettier-check", 17 | "jest": "jest --passWithNoTests", 18 | "test": "run-p --silent --print-label lint find-new-rules prettier-check jest", 19 | "semantic-release": "wsrun --serial semantic-release" 20 | }, 21 | "prettier": { 22 | "bracketSpacing": false, 23 | "jsxBracketSameLine": false, 24 | "printWidth": 80, 25 | "semi": true, 26 | "singleQuote": true, 27 | "tabWidth": 2, 28 | "trailingComma": "all", 29 | "useTabs": false 30 | }, 31 | "husky": { 32 | "hooks": { 33 | "pre-commit": "lint-staged", 34 | "commit-msg": "commitlint -e", 35 | "pre-push": "yarn test" 36 | } 37 | }, 38 | "lint-staged": { 39 | "**/*.{js,json,yml}": [ 40 | "prettier --write", 41 | "git add" 42 | ] 43 | }, 44 | "commitlint": { 45 | "extends": [ 46 | "@commitlint/config-conventional" 47 | ] 48 | }, 49 | "jest": { 50 | "roots": [ 51 | "/packages" 52 | ], 53 | "testEnvironment": "node", 54 | "testRegex": "/__tests__/.+-test\\.js$" 55 | }, 56 | "devDependencies": { 57 | "@anvilabs/eslint-config": "0.0.0-development", 58 | "@commitlint/cli": "^7.5.1", 59 | "@commitlint/config-conventional": "^7.5.0", 60 | "eslint": "^5.10.0", 61 | "eslint-find-rules": "^3.3.1", 62 | "husky": "^1.3.1", 63 | "jest": "^24.1.0", 64 | "lint-staged": "^8.1.3", 65 | "npm-run-all": "^4.1.5", 66 | "prettier": "^1.16.4", 67 | "semantic-release": "15.9.12", 68 | "semantic-release-monorepo": "6.1.1", 69 | "wsrun": "^3.6.4" 70 | }, 71 | "dependencies": {} 72 | } 73 | -------------------------------------------------------------------------------- /packages/eslint-config/README.md: -------------------------------------------------------------------------------- 1 | # @anvilabs/eslint-config 2 | 3 | [![Version](https://img.shields.io/npm/v/@anvilabs/eslint-config.svg)](http://npm.im/@anvilabs/eslint-config) 4 | [![Dependency Status](https://david-dm.org/anvilabs/eslint-config/status.svg?path=packages/eslint-config)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config) 5 | [![devDependency Status](https://david-dm.org/anvilabs/eslint-config/dev-status.svg?path=packages/eslint-config)](https://david-dm.org/anvilabs/eslint-config?path=packages/eslint-config&type=dev) 6 | 7 | Anvilabs' base ESLint config. Intended to be used together with [prettier](https://github.com/jlongster/prettier). 8 | 9 | ## Usage 10 | 11 | This config relies dangerously on npm@3/yarn flatter tree for its dependencies (because of [eslint/issues/3458](https://github.com/eslint/eslint/issues/3458)), so installation may be as simple as: 12 | 13 | ```bash 14 | $ yarn add eslint prettier @anvilabs/eslint-config --dev 15 | # or 16 | $ npm install eslint prettier @anvilabs/eslint-config --save-dev 17 | ``` 18 | 19 | Then add the extends to your `.eslintrc.js`: 20 | 21 | ```js 22 | module.exports = { 23 | extends: '@anvilabs/eslint-config', 24 | rules: { 25 | // your overrides 26 | }, 27 | }; 28 | ``` 29 | 30 | ### Other configs 31 | 32 | This config also exposes a few other configs that we use often and pull in as needed. 33 | 34 | You can use them standalone: 35 | 36 | ```js 37 | module.exports = { 38 | extends: '@anvilabs/eslint-config/', 39 | }; 40 | ``` 41 | 42 | Or in combination with the base config (recommended): 43 | 44 | ```js 45 | module.exports = { 46 | extends: ['@anvilabs/eslint-config', '@anvilabs/eslint-config/'], 47 | }; 48 | ``` 49 | 50 | You can also use [ESLint@4 overrides](http://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to apply a config only to certain files. For example: 51 | 52 | ```js 53 | module.exports = { 54 | ... 55 | overrides: [ 56 | Object.assign( 57 | { 58 | files: ['**/__tests__/*-test.js', '**/__mocks__/*.js'], 59 | }, 60 | require('@anvilabs/eslint-config/jest') 61 | ), 62 | ], 63 | }; 64 | ``` 65 | 66 | Available configs include: 67 | 68 | - `'@anvilabs/eslint-config/jest'` for [Jest](https://facebook.github.io/jest/) related rules 69 | - `'@anvilabs/eslint-config/lodash'` for [Lodash](https://lodash.com/) related rules 70 | - `'@anvilabs/eslint-config/ramda'` for [Ramda](https://ramdajs.com/) related rules 71 | - `'@anvilabs/eslint-config/script'` for usage with config files or scripts 72 | 73 | ## License 74 | 75 | [MIT License](../../LICENSE) © Anvilabs LLC 76 | -------------------------------------------------------------------------------- /packages/eslint-config-typescript/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['@typescript-eslint'], 3 | parser: '@typescript-eslint/parser', 4 | settings: { 5 | 'import/resolver': { 6 | typescript: { 7 | directory: process.cwd(), 8 | extensions: ['.js', '.ts', '.json'], 9 | }, 10 | }, 11 | 'import/extensions': ['.js', '.ts'], 12 | }, 13 | rules: { 14 | 'no-undef': 'off', 15 | 'spaced-comment': [ 16 | 'error', 17 | 'always', 18 | { 19 | line: { 20 | exceptions: ['-', '+'], 21 | markers: ['=', '!', '/'], // space here to support sprockets directives 22 | }, 23 | block: { 24 | exceptions: ['-', '+'], 25 | markers: ['=', '!'], // space here to support sprockets directives 26 | balanced: true, 27 | }, 28 | }, 29 | ], 30 | strict: 'off', // conflicts with typescript 31 | // https://github.com/benmosher/eslint-plugin-import 32 | 'import/extensions': [ 33 | 'error', 34 | 'always', 35 | { 36 | js: 'never', 37 | ts: 'never', 38 | }, 39 | ], 40 | 'import/named': 'off', // https://github.com/benmosher/eslint-plugin-import/issues/1282 41 | 'import/no-named-as-default-member': 'off', // conflicts with typescript 42 | 'import/no-named-as-default': 'off', // conflicts with typescript 43 | // https://github.com/nzakas/eslint-plugin-typescript 44 | '@typescript-eslint/adjacent-overload-signatures': 'error', 45 | '@typescript-eslint/array-type': 'error', 46 | '@typescript-eslint/ban-types': 'error', 47 | camelcase: 'off', 48 | '@typescript-eslint/camelcase': 'error', 49 | '@typescript-eslint/class-name-casing': 'error', 50 | '@typescript-eslint/explicit-function-return-type': 'off', 51 | '@typescript-eslint/explicit-member-accessibility': 'error', 52 | '@typescript-eslint/generic-type-naming': [ 53 | 'error', 54 | '^([TUKV]|T([A-Z0-9][a-zA-Z0-9]*){0,1})$', 55 | ], 56 | '@typescript-eslint/indent': 'off', 57 | '@typescript-eslint/interface-name-prefix': 'error', 58 | '@typescript-eslint/member-delimiter-style': 'off', 59 | '@typescript-eslint/member-naming': 'off', 60 | '@typescript-eslint/member-ordering': 'off', 61 | '@typescript-eslint/no-angle-bracket-type-assertion': 'error', 62 | 'no-array-constructor': 'off', 63 | '@typescript-eslint/no-array-constructor': 'error', 64 | '@typescript-eslint/no-empty-interface': 'off', 65 | '@typescript-eslint/no-explicit-any': 'off', 66 | '@typescript-eslint/no-extraneous-class': 'error', 67 | '@typescript-eslint/no-for-in-array': 'off', // requires type info 68 | '@typescript-eslint/no-inferrable-types': 'error', 69 | '@typescript-eslint/no-misused-new': 'error', 70 | '@typescript-eslint/no-namespace': 'error', 71 | '@typescript-eslint/no-non-null-assertion': 'error', 72 | '@typescript-eslint/no-object-literal-type-assertion': 'error', 73 | '@typescript-eslint/no-parameter-properties': 'error', 74 | '@typescript-eslint/no-require-imports': 'off', 75 | '@typescript-eslint/no-this-alias': 'error', 76 | '@typescript-eslint/no-triple-slash-reference': 'error', 77 | '@typescript-eslint/no-type-alias': [ 78 | 'off', 79 | { 80 | allowAliases: 'always', 81 | allowCallbacks: 'always', 82 | allowLiterals: 'in-unions-and-intersections', 83 | allowMappedTypes: 'always', 84 | }, 85 | ], 86 | '@typescript-eslint/no-unnecessary-type-assertion': 'off', // requires type info 87 | 'no-unused-vars': 'off', 88 | '@typescript-eslint/no-unused-vars': 'off', // in favor of tsc's `noUnusedLocals` and `noUnusedParameters` 89 | '@typescript-eslint/no-use-before-define': 'error', 90 | 'no-useless-constructor': 'off', 91 | '@typescript-eslint/no-useless-constructor': 'error', 92 | '@typescript-eslint/no-var-requires': 'off', 93 | '@typescript-eslint/prefer-interface': 'error', 94 | '@typescript-eslint/prefer-namespace-keyword': 'error', 95 | '@typescript-eslint/promise-function-async': 'off', 96 | '@typescript-eslint/type-annotation-spacing': 'off', 97 | '@typescript-eslint/restrict-plus-operands': 'off', // requires type info 98 | }, 99 | }; 100 | -------------------------------------------------------------------------------- /packages/eslint-config/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['airbnb-base', 'prettier'], 3 | plugins: [ 4 | 'eslint-comments', 5 | 'no-use-extend-native', 6 | 'promise', 7 | 'sort-imports-es6-autofix', 8 | 'unicorn', 9 | ], 10 | rules: { 11 | // http://eslint.org/docs/rules 12 | 'no-warning-comments': [ 13 | 'warn', 14 | {terms: ['todo', 'fixme'], location: 'start'}, 15 | ], 16 | 'implicit-arrow-linebreak': 'off', // not necessary with prettier 17 | 'max-depth': ['error', {max: 4}], 18 | 'max-nested-callbacks': ['error', {max: 3}], 19 | 'max-params': ['error', {max: 4}], 20 | 'max-statements-per-line': ['error', {max: 1}], 21 | 'newline-before-return': 'error', 22 | 'no-compare-neg-zero': 'error', 23 | 'no-implicit-coercion': [ 24 | 'error', 25 | {boolean: true, number: true, string: true}, 26 | ], 27 | 'no-magic-numbers': [ 28 | 'warn', 29 | { 30 | ignore: [-1, 0, 1], 31 | ignoreArrayIndexes: true, 32 | enforceConst: true, 33 | detectObjects: false, 34 | }, 35 | ], 36 | // https://github.com/mysticatea/eslint-plugin-eslint-comments 37 | 'eslint-comments/disable-enable-pair': 'error', 38 | 'eslint-comments/no-duplicate-disable': 'error', 39 | 'eslint-comments/no-restricted-disable': 'off', 40 | 'eslint-comments/no-unlimited-disable': 'error', 41 | 'eslint-comments/no-unused-disable': 'error', 42 | 'eslint-comments/no-unused-enable': 'error', 43 | 'eslint-comments/no-aggregating-enable': 'error', 44 | 'eslint-comments/no-use': [ 45 | 'error', 46 | { 47 | allow: [ 48 | 'eslint-disable', 49 | 'eslint-disable-line', 50 | 'eslint-disable-next-line', 51 | 'eslint-enable', 52 | ], 53 | }, 54 | ], 55 | // https://github.com/benmosher/eslint-plugin-import 56 | 'import/dynamic-import-chunkname': 'error', 57 | 'import/exports-last': 'error', 58 | 'import/group-exports': 'off', // false positives wit import/export syntax 59 | 'import/no-anonymous-default-export': 'error', 60 | 'import/no-cycle': 'off', 61 | 'import/no-default-export': 'off', 62 | 'import/no-named-export': 'off', 63 | 'import/no-relative-parent-imports': 'off', 64 | 'import/no-self-import': 'error', 65 | 'import/no-useless-path-segments': 'error', 66 | 'import/order': [ 67 | 'error', 68 | { 69 | groups: [ 70 | 'builtin', 71 | 'external', 72 | 'internal', 73 | ['parent', 'sibling', 'index'], 74 | ], 75 | 'newlines-between': 'always', 76 | }, 77 | ], 78 | 'import/prefer-default-export': 'off', 79 | // https://github.com/dustinspecker/eslint-plugin-no-use-extend-native 80 | 'no-use-extend-native/no-use-extend-native': 'error', 81 | // https://github.com/xjamundx/eslint-plugin-promise 82 | 'promise/always-return': 'error', 83 | 'promise/avoid-new': 'off', 84 | 'promise/catch-or-return': 'error', 85 | 'promise/no-callback-in-promise': 'error', 86 | 'promise/no-native': 'off', 87 | 'promise/no-nesting': 'error', 88 | 'promise/no-new-statics': 'error', 89 | 'promise/no-promise-in-callback': 'error', 90 | 'promise/no-return-in-finally': 'error', 91 | 'promise/no-return-wrap': 'error', 92 | 'promise/param-names': 'error', 93 | 'promise/prefer-await-to-callbacks': 'off', 94 | 'promise/prefer-await-to-then': 'error', 95 | 'promise/valid-params': 'error', 96 | // https://github.com/marudor/eslint-plugin-sort-imports-es6-autofix 97 | 'sort-imports-es6-autofix/sort-imports-es6': [ 98 | 'error', 99 | { 100 | ignoreCase: false, 101 | ignoreMemberSort: true, 102 | memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], 103 | }, 104 | ], 105 | // https://github.com/sindresorhus/eslint-plugin-unicorn 106 | 'unicorn/catch-error-name': 'off', 107 | 'unicorn/custom-error-definition': 'off', 108 | 'unicorn/error-message': 'error', 109 | 'unicorn/escape-case': 'error', 110 | 'unicorn/explicit-length-check': ['error', {'non-zero': 'not-equal'}], 111 | 'unicorn/filename-case': 'off', 112 | 'unicorn/import-index': 'error', 113 | 'unicorn/new-for-builtins': 'error', 114 | 'unicorn/no-abusive-eslint-disable': 'off', // disabled in favor of `eslint-comments/no-unlimited-disable` 115 | 'unicorn/no-array-instanceof': 'error', 116 | 'unicorn/no-console-spaces': 'off', 117 | 'unicorn/no-fn-reference-in-iterator': 'error', 118 | 'unicorn/no-hex-escape': 'error', 119 | 'unicorn/no-new-buffer': 'error', 120 | 'unicorn/no-process-exit': 'error', 121 | 'unicorn/no-unreadable-array-destructuring': 'off', 122 | 'unicorn/no-unsafe-regex': 'off', 123 | 'unicorn/no-unused-properties': 'off', 124 | 'unicorn/number-literal-case': 'off', // conflicts with prettier 125 | 'unicorn/prefer-add-event-listener': 'error', 126 | 'unicorn/prefer-exponentiation-operator': 'error', 127 | 'unicorn/prefer-node-append': 'off', 128 | 'unicorn/prefer-query-selector': 'off', 129 | 'unicorn/prefer-spread': 'error', 130 | 'unicorn/prefer-starts-ends-with': 'error', 131 | 'unicorn/prefer-type-error': 'off', 132 | 'unicorn/regex-shorthand': 'error', 133 | 'unicorn/throw-new-error': 'error', 134 | }, 135 | }; 136 | -------------------------------------------------------------------------------- /packages/eslint-config-react/base.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['prettier/react'], 3 | plugins: ['react'], 4 | parserOptions: { 5 | ecmaFeatures: { 6 | jsx: true, 7 | }, 8 | }, 9 | settings: { 10 | 'import/extensions': ['.js', 'jsx'], 11 | }, 12 | rules: { 13 | 'class-methods-use-this': [ 14 | 'error', 15 | { 16 | exceptMethods: [ 17 | 'render', 18 | 'getInitialState', 19 | 'getDefaultProps', 20 | 'getChildContext', 21 | 'componentWillMount', 22 | 'componentDidMount', 23 | 'componentWillReceiveProps', 24 | 'shouldComponentUpdate', 25 | 'componentWillUpdate', 26 | 'componentDidUpdate', 27 | 'componentWillUnmount', 28 | ], 29 | }, 30 | ], 31 | 'jsx-quotes': ['error', 'prefer-double'], 32 | 'no-unused-expressions': ['error', {allowShortCircuit: true}], 33 | // https://github.com/yannickcr/eslint-plugin-react 34 | 'react/boolean-prop-naming': 'off', 35 | 'react/button-has-type': 'error', 36 | 'react/default-props-match-prop-types': 'error', 37 | 'react/destructuring-assignment': 'off', // TODO: decide on what option to use 38 | 'react/display-name': 'error', 39 | 'react/forbid-component-props': 'off', 40 | 'react/forbid-dom-props': 'off', 41 | 'react/forbid-elements': 'off', 42 | 'react/forbid-foreign-prop-types': 'off', 43 | 'react/forbid-prop-types': ['error', {forbid: ['any', 'array', 'object']}], 44 | 'react/jsx-fragments': ['error', 'syntax'], 45 | 'react/jsx-boolean-value': ['error', 'never'], 46 | 'react/jsx-child-element-spacing': 'off', // TODO: remove once `eslint-config-prettier` adds this 47 | 'react/jsx-curly-brace-presence': ['error', 'never'], 48 | 'react/jsx-filename-extension': ['error', {extensions: ['.jsx']}], 49 | 'react/jsx-handler-names': [ 50 | 'off', 51 | {eventHandlerPrefix: 'handle', eventHandlerPropPrefix: 'on'}, 52 | ], 53 | 'react/jsx-key': 'error', 54 | // TODO: disable `ignoreRefs` and`allowArrowFunctions` options 55 | 'react/jsx-no-bind': [ 56 | 'error', 57 | {ignoreRefs: true, allowArrowFunctions: true, allowBind: false}, 58 | ], 59 | 'react/jsx-max-depth': 'off', 60 | 'react/jsx-no-comment-textnodes': 'error', 61 | 'react/jsx-no-duplicate-props': ['error', {ignoreCase: true}], 62 | 'react/jsx-no-literals': 'off', 63 | 'react/jsx-no-target-blank': 'error', 64 | 'react/jsx-no-undef': 'error', 65 | 'react/jsx-one-expression-per-line': 'off', 66 | 'react/jsx-pascal-case': ['error', {allowAllCaps: true, ignore: []}], 67 | 'react/jsx-props-no-multi-spaces': 'off', // not necessary with prettier 68 | 'react/jsx-sort-default-props': 'off', 69 | 'react/jsx-sort-prop-types': 'off', // deprecated in favor of react/jsx-sort-props 70 | 'react/jsx-sort-props': 'off', 71 | 'react/jsx-uses-react': 'error', 72 | 'react/jsx-uses-vars': 'error', 73 | 'react/no-access-state-in-setstate': 'error', 74 | 'react/no-array-index-key': 'error', 75 | 'react/no-children-prop': 'error', 76 | 'react/no-comment-textnodes': 'off', // deprecated in favor of react/jsx-no-comment-textnodes 77 | 'react/no-danger-with-children': 'error', 78 | 'react/no-danger': 'error', 79 | 'react/no-deprecated': 'error', 80 | 'react/no-did-mount-set-state': 'error', 81 | 'react/no-did-update-set-state': 'error', 82 | 'react/no-direct-mutation-state': 'error', 83 | 'react/no-find-dom-node': 'error', 84 | 'react/no-is-mounted': 'error', 85 | 'react/no-multi-comp': ['error', {ignoreStateless: true}], 86 | 'react/no-redundant-should-component-update': 'error', 87 | 'react/no-render-return-value': 'error', 88 | 'react/no-set-state': 'off', 89 | 'react/no-string-refs': 'error', 90 | 'react/no-this-in-sfc': 'error', 91 | 'react/no-typos': 'error', 92 | 'react/no-unescaped-entities': 'error', 93 | 'react/no-unknown-property': 'error', 94 | 'react/no-unsafe': 'error', 95 | 'react/no-unused-prop-types': 'off', 96 | 'react/no-unused-state': 'error', 97 | 'react/no-will-update-set-state': 'error', 98 | 'react/prefer-es6-class': ['error', 'always'], 99 | 'react/prefer-stateless-function': 'off', 100 | 'react/prop-types': [ 101 | 'off', 102 | {ignore: [], customValidators: [], skipUndeclared: false}, 103 | ], 104 | 'react/react-in-jsx-scope': 'error', 105 | 'react/require-default-props': ['error', {forbidDefaultForRequired: true}], 106 | 'react/require-extension': 'off', // deprecated in favor of import/extensions 107 | 'react/require-optimization': 'off', 108 | 'react/require-render-return': 'error', 109 | 'react/self-closing-comp': 'error', 110 | 'react/sort-comp': [ 111 | 'error', 112 | { 113 | order: [ 114 | 'type-annotations', 115 | 'static-methods', 116 | 'instance-variables', 117 | 'lifecycle', 118 | '/^handle.+$/', 119 | '/^(is|get|set)(?!(InitialState$|DefaultProps$|ChildContext$|InitialProps$)).+$/', 120 | 'everything-else', 121 | '/^render.+$/', 122 | 'render', 123 | ], 124 | }, 125 | ], 126 | 'react/sort-prop-types': 'off', // we don't use prop-types 127 | 'react/style-prop-object': 'error', 128 | 'react/void-dom-elements-no-children': 'error', 129 | }, 130 | }; 131 | --------------------------------------------------------------------------------