├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── base.js ├── index.js ├── media └── logo.svg ├── package-lock.json ├── package.json └── rules ├── base.js └── vue.js /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 3 | version: 2.1 4 | jobs: 5 | build: 6 | docker: 7 | - image: circleci/node:lts 8 | 9 | working_directory: ~/eslint-config-extensionengine 10 | 11 | steps: 12 | - checkout 13 | 14 | - restore_cache: 15 | keys: 16 | - dependency-cache-{{ checksum "package-lock.json" }} 17 | 18 | - run: 19 | name: Install dependencies 20 | command: npm install 21 | 22 | - save_cache: 23 | key: dependency-cache-{{ checksum "package-lock.json" }} 24 | paths: 25 | - node_modules 26 | 27 | - run: 28 | name: Run tests 29 | command: npm test 30 | 31 | - run: 32 | name: Lint codebase 33 | command: npm run lint 34 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: './base' 5 | }; 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) 2019 Extension Engine, LLC 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 | # @extensionengine/eslint-config 8 | 9 | [![circleci build status](https://badgen.net/circleci/github/ExtensionEngine/eslint-config/master?icon)](https://app.circleci.com/pipelines/github/ExtensionEngine/eslint-config?branch=master) 10 | [![install size](https://badgen.net/packagephobia/install/@extensionengine/eslint-config)](https://packagephobia.now.sh/result?p=@extensionengine/eslint-config) 11 | [![npm package version](https://badgen.net/npm/v/@extensionengine/eslint-config)](https://npm.im/@extensionengine/eslint-config) 12 | [![github license](https://badgen.net/github/license/ExtensionEngine/eslint-config)](https://github.com/ExtensionEngine/eslint-config/blob/master/LICENSE) 13 | 14 | This package provides Extension Engine's extensible ESLint config. 15 | 16 | ## Usage 17 | 18 | Package contains two shared ESLint configs: 19 | 20 | ### @extensionengine/eslint-config 21 | 22 | This is default configuration supporting both server & Vue powered client codebases. 23 | 24 | ### @extensionengine/eslint-config/base 25 | 26 | This is base configuration without Vue specific rules. 27 | 28 | ### Install 29 | 30 | Use `install-peerdeps` 31 | 32 | ``` 33 | npx install-peerdeps --dev @extensionengine/eslint-config 34 | ``` 35 | 36 | or the classic way: 37 | 38 | ``` 39 | npm install --save-dev eslint @extensionengine/eslint-config @babel/eslint-parser @babel/eslint-plugin eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-require-sort eslint-plugin-vue eslint-config-standard eslint-config-semistandard 40 | ``` 41 | 42 | ### Using `@extensionengine/eslint-config` in your project 43 | 44 | In your local `.eslintrc.*` extend this configuration 45 | 46 | ```js 47 | 'use strict'; 48 | 49 | module.exports = { 50 | root: true, 51 | extends: '@extensionengine' 52 | }; 53 | ``` 54 | 55 | If you don't need Vue you can use base configuration: 56 | 57 | ```js 58 | 'use strict'; 59 | 60 | module.exports = { 61 | root: true, 62 | extends: '@extensionengine/eslint-config/base' 63 | }; 64 | ``` 65 | 66 | Check [ESlint documentation](https://eslint.org/docs/rules/) for rules explanation. 67 | 68 | 69 | ### Badge 70 | 71 | If you are using this config in your project you can include this badge in a 72 | readme to let people know that your code is using it. 73 | 74 | [![js @extensionengine style](https://badgen.net/badge/code%20style/@extensionengine/black)](https://github.com/ExtensionEngine/eslint-config) 75 | 76 | ```markdown 77 | [![js @extensionengine style](https://badgen.net/badge/code%20style/@extensionengine/black)](https://github.com/ExtensionEngine/eslint-config) 78 | ``` 79 | -------------------------------------------------------------------------------- /base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** @type {import('@types/eslint').Linter.Config} */ 4 | module.exports = { 5 | parserOptions: { 6 | sourceType: 'script' 7 | }, 8 | plugins: ['@babel'], 9 | overrides: [{ 10 | files: ['client/**'], 11 | parserOptions: { 12 | parser: '@babel/eslint-parser', 13 | sourceType: 'module' 14 | } 15 | }], 16 | extends: [ 17 | 'semistandard', 18 | './rules/base' 19 | ] 20 | }; 21 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** @type {import('@types/eslint').Linter.Config} */ 4 | module.exports = { 5 | parserOptions: { 6 | sourceType: 'script' 7 | }, 8 | plugins: ['@babel'], 9 | overrides: [{ 10 | files: ['client/**'], 11 | parserOptions: { 12 | parser: '@babel/eslint-parser', 13 | sourceType: 'module' 14 | } 15 | }], 16 | extends: [ 17 | 'semistandard', 18 | './rules/base', 19 | './rules/vue' 20 | ] 21 | }; 22 | -------------------------------------------------------------------------------- /media/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@extensionengine/eslint-config", 3 | "version": "5.0.0", 4 | "description": "Extension Engine's ESLint config", 5 | "keywords": [ 6 | "eslint", 7 | "eslint config", 8 | "config", 9 | "Extension Engine", 10 | "javascript", 11 | "vue", 12 | "node" 13 | ], 14 | "homepage": "https://github.com/ExtensionEngine/eslint-config#readme", 15 | "bugs": { 16 | "url": "https://github.com/ExtensionEngine/eslint-config/issues" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/ExtensionEngine/eslint-config.git" 21 | }, 22 | "license": "MIT", 23 | "author": { 24 | "name": "Extension Engine", 25 | "email": "info@extensionengine.com", 26 | "url": "https://extensionengine.com" 27 | }, 28 | "main": "index.js", 29 | "files": [ 30 | "rules", 31 | "base.js" 32 | ], 33 | "scripts": { 34 | "lint": "eslint .", 35 | "release": "npx np", 36 | "test": "" 37 | }, 38 | "devDependencies": { 39 | "@babel/eslint-parser": "^7.22.6", 40 | "@babel/eslint-plugin": "^7.22.5", 41 | "@types/eslint": "^8.40.2", 42 | "eslint": "^8.44.0", 43 | "eslint-config-semistandard": "^17.0.0", 44 | "eslint-config-standard": "^17.1.0", 45 | "eslint-plugin-import": "^2.27.5", 46 | "eslint-plugin-n": "^16.0.1", 47 | "eslint-plugin-promise": "^6.1.1", 48 | "eslint-plugin-require-sort": "^1.3.0", 49 | "eslint-plugin-vue": "^9.15.1" 50 | }, 51 | "peerDependencies": { 52 | "@babel/eslint-parser": ">=7.22.6", 53 | "@babel/eslint-plugin": ">=7.22.5", 54 | "eslint": ">=8.44.0", 55 | "eslint-config-semistandard": ">=7.0.0", 56 | "eslint-config-standard": ">=17.1.0", 57 | "eslint-plugin-import": ">=2.27.5", 58 | "eslint-plugin-n": ">=16.0.1", 59 | "eslint-plugin-promise": ">=6.1.1", 60 | "eslint-plugin-require-sort": ">=1.3.0", 61 | "eslint-plugin-vue": ">=9.15.1" 62 | }, 63 | "overrides": { 64 | "eslint-config-semistandard": { 65 | "eslint-plugin-n": "$eslint-plugin-n" 66 | } 67 | }, 68 | "publishConfig": { 69 | "access": "public" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /rules/base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const isProduction = process.env.NODE_ENV === 'production'; 4 | 5 | /** @type {import('@types/eslint').Linter.Config} */ 6 | module.exports = { 7 | plugins: ['require-sort'], 8 | rules: { 9 | strict: ['error', 'safe'], 10 | indent: ['error', 2, { 11 | SwitchCase: 1, 12 | MemberExpression: 'off' 13 | }], 14 | 'arrow-parens': ['error', 'as-needed'], 15 | 'no-debugger': isProduction ? 'error' : 'warn', 16 | 'no-unreachable': isProduction ? 'error' : 'warn', 17 | 'space-before-function-paren': ['error', { 18 | anonymous: 'always', 19 | named: 'never' 20 | }], 21 | 'sort-imports': ['error', { 22 | ignoreCase: true 23 | }], 24 | 'require-sort/require-sort': ['error', { 25 | ignoreCase: true 26 | }] 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /rules/vue.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** @type {import('@types/eslint').Linter.Config} */ 4 | module.exports = { 5 | extends: 'plugin:vue/recommended', 6 | plugins: ['vue'], 7 | rules: { 8 | 'vue/html-self-closing': ['error', { 9 | html: { 10 | void: 'never', 11 | normal: 'never', 12 | component: 'always' 13 | }, 14 | svg: 'never', 15 | math: 'never' 16 | }], 17 | 'vue/html-closing-bracket-newline': ['error', { 18 | singleline: 'never', 19 | multiline: 'never' 20 | }], 21 | 'vue/singleline-html-element-content-newline': 'off', 22 | 'vue/multi-word-component-names': 'off', 23 | 'vue/max-attributes-per-line': ['error', { 24 | singleline: 5, 25 | multiline: 4 26 | }], 27 | 'vue/attributes-order': ['error', { 28 | order: [ 29 | 'DEFINITION', 30 | 'LIST_RENDERING', 31 | 'CONDITIONALS', 32 | 'RENDER_MODIFIERS', 33 | 'UNIQUE', 34 | 'TWO_WAY_BINDING', 35 | 'OTHER_DIRECTIVES', 36 | 'EVENTS', 37 | 'GLOBAL', 38 | 'OTHER_ATTR', 39 | 'CONTENT' 40 | ] 41 | }], 42 | 'vue/order-in-components': ['error', { 43 | order: [ 44 | 'el', 45 | 'name', 46 | ['template', 'render', 'renderError'], 47 | ['parent', 'functional', 'delimiters', 'comments'], 48 | 'extends', 49 | 'mixins', 50 | 'inheritAttrs', 51 | 'model', 52 | ['props', 'propsData'], 53 | 'data', 54 | 'computed', 55 | 'methods', 56 | 'watch', 57 | 'LIFECYCLE_HOOKS', 58 | ['directives', 'filters'], 59 | 'components' 60 | ] 61 | }], 62 | 'vue/component-definition-name-casing': ['error', 'kebab-case'] 63 | } 64 | }; 65 | --------------------------------------------------------------------------------