├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .ncurc ├── .npmignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── README.md ├── SECURITY.md ├── constants.js ├── detect ├── configs.js ├── parsers.js └── plugins.js ├── index.js ├── lib ├── config.js ├── hasPackage.js ├── is-module-available.js ├── loaded.js ├── missing.js └── utils.js ├── package.json ├── rules ├── @babel │ └── eslint-parser.js ├── @typescript-eslint │ ├── eslint-plugin.js │ └── parser.js ├── adjunct.js ├── airbnb-babel.js ├── airbnb-base.js ├── airbnb-typescript.js ├── airbnb.js ├── babel.js ├── compat.js ├── node.js ├── overrides.js └── react-native.js └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | # editorconfig-tools is unable to ignore longs strings or urls 9 | max_line_length = null 10 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["./index.js"], 3 | "rules": { 4 | "sonarjs/no-nested-template-literals": 0, 5 | "security/detect-non-literal-fs-filename": 0, 6 | "unicorn/prevent-abbreviations": 0, 7 | "unicorn/prefer-module": 0, 8 | "unicorn/prefer-node-protocol": 0 9 | }, 10 | "env": { 11 | "es6": true, 12 | "node": true 13 | }, 14 | "parserOptions": { 15 | "ecmaVersion": 2020, 16 | "sourceType": "module", 17 | "ecmaFeatures": { 18 | "generators": false, 19 | "objectLiteralDuplicateProperties": false 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js text eol=lf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | # github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | # patreon: # Replace with a single Patreon username 5 | # open_collective: # Replace with a single Open Collective username 6 | # ko_fi: # Replace with a single Ko-fi username 7 | # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | # liberapay: # Replace with a single Liberapay username 10 | # issuehunt: # Replace with a single IssueHunt username 11 | # otechie: # Replace with a single Otechie username 12 | # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | 14 | github: davidjbradshaw 15 | custom: ['https://www.buymeacoffee.com/davidjbradshaw'] 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # 5 | version: 2 6 | updates: 7 | - package-ecosystem: "npm" # See documentation for possible values 8 | directory: "/" # Location of package manifests 9 | schedule: 10 | interval: "monthly" 11 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "master" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "master" ] 20 | schedule: 21 | - cron: '31 15 * * 3' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | yarn.lock -------------------------------------------------------------------------------- /.ncurc: -------------------------------------------------------------------------------- 1 | { 2 | "reject": ["arrify","read-pkg-up"] 3 | } 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .coveralls.yml 3 | .idea 4 | node_modules 5 | bin 6 | docs 7 | example 8 | test 9 | spec 10 | src 11 | npm-debug.log 12 | bower_components 13 | bower.json 14 | gruntfile.js 15 | karma.conf.js 16 | test-main.js 17 | coverage* 18 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | package.json 2 | node_modules 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": false, 6 | "singleQuote": true, 7 | "trailingComma": "es5", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # eslint-config-auto  [![NPM version](https://badge.fury.io/js/eslint-config-auto.svg)](http://badge.fury.io/js/eslint-config-auto) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) 2 | 3 | > Automatically configure ESLint based on project dependencies 4 | 5 | This project got created because I got tired of managing [eslint](https://eslint.org) in multiple different projects and trying to keep them all vaguely in sync. It will automatically configure the most appropriate version of the [airbnb eslint rules](https://github.com/airbnb/javascript) and a curated selection of [plugins](https://github.com/davidjbradshaw/eslint-config-auto#rules) based on the contents of your project's `package.json` file each time you run eslint. When you add a new library to your project, the associated plugin will get automatically included. 6 | 7 | The aim here is to include a range of _mostly reasonable_ plugins, whilst not being overly restrictive. The recommended configs for each plugin are used with a few exceptions for rules that have been [disabled](https://github.com/davidjbradshaw/eslint-config-auto#rules-1) for appearing unduely restrictive or conflicting with other plugins. If you use Prettier then all the formating rules are also omitted by including [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier). 8 | 9 | In addition to JavaScript, suport is included for linting TypeScript, HTML, Json, and MarkDown files. 10 | 11 | ## Alternative 12 | 13 | If you like the ideas behind this config, but not the AirBnB styleguide, then checkout [eslint-config-adjunt](https://github.com/davidjbradshaw/eslint-config-adjunct). It includes most of the extra plugins used here, but lets you choose your prefered main eslint config. 14 | 15 | ## Contibuting 16 | 17 | Suggestions for adding new plugings will be carefully considered against the _mostly reasonable_ standard and usefulness. If you would like to help out, then I would like to add support for _Vue_ and other popular frameworks. Thanks goes to [awesome-eslint](https://github.com/dustinspecker/awesome-eslint) for having collated the packages this project utalises. 18 | 19 | ## Install 20 | 21 | To install this config, run the following command. 22 | 23 | ```sh 24 | npm install eslint-config-auto --save-dev 25 | ``` 26 | 27 | ## Configure 28 | 29 | Create an `.eslintrc` file with the following contents. 30 | 31 | ```json 32 | { 33 | "extends": ["auto"] 34 | } 35 | ``` 36 | 37 | You can now include `html`, `json` and `markdown` in the list of files passed to `eslint` to lint any JavaScript contained. 38 | 39 | ```json 40 | { 41 | "scripts": { 42 | "eslint": "eslint --color --ext .html,.js,.json,.jsx,.md,.ts,.tsx *.* src", 43 | "eslint:fix": "npm run eslint -- --fix" 44 | } 45 | } 46 | ``` 47 | 48 | ## Install Dependencies 49 | 50 | After you have configured `eslint` to include this package, the first time you run `eslint` it will output the `npm` command to install the dependencies required for your project. Copy and paste this command into the console, and you are then ready to start linting. 51 | 52 | ## Rules 53 | 54 | ### AirBNB 55 | 56 | The most appropreate version of the AirBNB eslint config will be automatically selected. 57 | 58 | ### Babel 59 | 60 | If the project includes Babel in it's `devDependencies`, then [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) and [eslint-config-airbnb-babel](https://github.com/davidjbradshaw/eslint-config-airbnb-babel) will be loaded and the parser will be set to `babel-eslint`. 61 | 62 | Some project setup utils, such as [Create React App](https://github.com/facebook/create-react-app), use Babel without including it as a project dependancies. In such cases you can turn Babel support on by adding `settings: { babel: true }` to your `.eslintrc` config file. 63 | 64 | ### Code Quality 65 | 66 | These two plugins provide a range of code quality rules: 67 | 68 | - [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) 69 | - [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) 70 | 71 | ### Compat 72 | 73 | If `settings.compat = true` in your `.eslintrc`, then [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) is loaded. 74 | 75 | ### Langauges 76 | 77 | The following plugins expand esLint to support TypeScript, JSON, and lint code contiained in HTML and MarkDown files: 78 | 79 | - [@eslint-typescript](https://github.com/typescript-eslint/typescript-eslint) 80 | - [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json) 81 | - [eslint-plugin-html](https://github.com/BenoitZugmeyer/eslint-plugin-html) 82 | - [eslint-plugin-markdown](https://github.com/eslint/eslint-plugin-markdown) 83 | 84 | _If the project includes TypeScript, then the rules will adapt to lint typescript files and the parser will be set to `@typescript-eslint/parser` for `ts` and `tsx` filetypes._ 85 | 86 | _When linting code snippets in Markdown files, a few [rules](https://github.com/davidjbradshaw/eslint-config-adjunct/blob/master/rules/markdown.js#L3) relating to globals and unused vars are disabled._ 87 | 88 | ### Library Plugins 89 | 90 | These plugins will be loaded in based on your project `dependencies` in `package.json`. If a supported library is part of your project then it's related esLint plugins will be loaded. The following packages are supported: 91 | 92 | - [eslint-plugin-lodash](https://github.com/wix/eslint-plugin-lodash) 93 | - [eslint-plugin-lodash-fp](https://github.com/jfmengels/eslint-plugin-lodash-fp) 94 | - [eslint-plugin-ramda](https://github.com/ramda/eslint-plugin-ramda) 95 | 96 | ### Node 97 | 98 | If `env.node = true` in your `.eslintrc` file, then [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) is loaded. 99 | 100 | ### React 101 | 102 | If a project contains React, then a React version of the AirBNB config will be used and if Redux is installed the following extra plugins will be loaded. 103 | 104 | - [eslint-plugin-fsa](https://github.com/joseph-galindo/eslint-plugin-fsa) 105 | - [eslint-plugin-react-redux](https://github.com/DianaSuvorova/eslint-plugin-react-redux#readme) 106 | - [eslint-plugin-redux-saga](https://github.com/pke/eslint-plugin-redux-saga) 107 | 108 | ### Practices 109 | 110 | The following esLint plugins enforce good coding practices: 111 | 112 | - [eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func) 113 | - [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments) 114 | - [eslint-plugin-no-constructor-bind](https://github.com/markalfred/eslint-plugin-no-constructor-bind) 115 | - [eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native) 116 | - [eslint-plugin-optimize-regex](https://github.com/BrainMaestro/eslint-plugin-optimize-regex) 117 | - [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) 118 | - [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort) 119 | - [eslint-plugin-switch-case](https://github.com/lukeapage/eslint-plugin-switch-case) 120 | 121 | ### Prettier 122 | 123 | If prettier is installed, any rules that may conflict with Prettier will be disabled. The plugin should read you Prettier config from your project's root. 124 | 125 | - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) 126 | 127 | The prettier configs for different eslint plugins are also automatically included based on which eslint plugins have been installed into your project. 128 | 129 | ### Security 130 | 131 | These plugins add code security rules to esLint: 132 | 133 | - [eslint-plugin-no-secrets](https://github.com/nickdeis/eslint-plugin-no-secrets) 134 | - [eslint-plugin-no-unsanitized](https://github.com/mozilla/eslint-plugin-no-unsanitized) 135 | - [eslint-plugin-scanjs-rules](https://github.com/mozfreddyb/eslint-plugin-scanjs-rules) 136 | - [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security) 137 | 138 | ### Test Libraries 139 | 140 | Test plugins are loaded based on which testing tools you have listed in `devDependencies` of `package.json`. The following test plugins are supported: 141 | 142 | - [eslint-plugin-ava](https://github.com/avajs/eslint-plugin-ava) 143 | - [eslint-plugin-chai-expect](https://github.com/turbo87/eslint-plugin-chai-expect) 144 | - [eslint-plugin-chai-friendly](https://github.com/ihordiachenko/eslint-plugin-chai-friendly) 145 | - [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) 146 | - [eslint-plugin-jasmine](https://github.com/tlvince/eslint-plugin-jasmine) 147 | - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) 148 | - [eslint-plugin-jest-async](https://www.npmjs.com/package/eslint-plugin-jest-async) 149 | - [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) 150 | - [eslint-plugin-mocha-cleanup](https://github.com/onechiporenko/eslint-plugin-mocha-cleanup/) 151 | - [eslint-plugin-qunit](https://github.com/platinumazure/eslint-plugin-qunit) 152 | - [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) 153 | 154 | _For test files a few [rules](https://github.com/davidjbradshaw/eslint-config-adjunct/blob/master/rules/test-overrides.js) are turned off, to better to support normal unit test coding styles._ 155 | 156 | ## Rules 157 | 158 | In the most part the default rules are used for the plugins listed above, with the following exceptions. 159 | 160 | ### Switch-Case 161 | 162 | Adds the `fallthrough: 'never'` option to the `newline-between-switch-case` rule. 163 | 164 | ```js 165 | // Good 166 | 167 | switch (foo) { 168 | case 1: 169 | something() 170 | break 171 | 172 | case 2: 173 | case 3: 174 | somethingElse() 175 | break 176 | 177 | default: 178 | defaultThing() 179 | } 180 | ``` 181 | 182 | ### Disabled rules 183 | 184 | The following rules are disabled due to them being considered unduly restrictive or unhelpful. 185 | 186 | - jest/no-disabled-tests 187 | - react-redux/prefer-separate-component-file 188 | - redux-saga/no-unhandled-errors 189 | - lodash/prefer over native rules 190 | - lodash-fp/use-fp 191 | - unicorn/no-array-for-each 192 | - unicorn/no-fn-reference-in-iterator 193 | - unicorn/no-array-for-each 194 | - unicorn/no-reduce 195 | - unicorn/no-null 196 | - unicorn/prefer-number-properties 197 | - unicorn/prefer-optional-catch-binding 198 | - unicorn/prevent-abbreviations 199 | 200 | The following rules are disabled due to clashing with other plugins 201 | 202 | - array-func/prefer-array-from 203 | - import/order 204 | - sort-imports 205 | 206 | ## License 207 | 208 | Copyright © 2020-21 [David J. Bradshaw](https://github.com/davidjbradshaw). 209 | Licensed under the [MIT License](LICENSE). 210 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Security updates are supported of the latest version. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). 10 | Tidelift will coordinate the fix and disclosure. 11 | -------------------------------------------------------------------------------- /constants.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | CONFIG_NAME: 'eslint-config-auto', 3 | } 4 | -------------------------------------------------------------------------------- /detect/configs.js: -------------------------------------------------------------------------------- 1 | const { hasBabel, hasTypeScript, hasReact } = require('../lib/hasPackage') 2 | 3 | const configs = [] 4 | 5 | // if (hasTypeScript) configs.push('@typescript-eslint/eslint-plugin') 6 | 7 | configs.push(hasReact ? 'airbnb' : 'airbnb-base') 8 | if (hasTypeScript) configs.push('airbnb-typescript') 9 | if (hasBabel) configs.push('airbnb-babel') 10 | 11 | configs.push('adjunct') 12 | 13 | module.exports = configs 14 | -------------------------------------------------------------------------------- /detect/parsers.js: -------------------------------------------------------------------------------- 1 | const { hasBabel, hasTypeScript } = require('../lib/hasPackage') 2 | 3 | const parsers = [] 4 | 5 | if (hasBabel) parsers.push('@babel/eslint-parser') 6 | 7 | if (hasTypeScript) parsers.push('@typescript-eslint/parser') 8 | 9 | module.exports = parsers 10 | -------------------------------------------------------------------------------- /detect/plugins.js: -------------------------------------------------------------------------------- 1 | const { env = {}, settings = {} } = require('../lib/config') 2 | const { hasAnyDep } = require('../lib/utils') 3 | const { hasBabel } = require('../lib/hasPackage') 4 | 5 | const plugins = [] 6 | 7 | if (hasAnyDep('react-native')) plugins.push('react-native') 8 | 9 | if (hasAnyDep('ember-source')) plugins.push('ember', 'ember-best-practices') 10 | if (hasAnyDep('ember-template-lint')) plugins.push('hbs') 11 | 12 | if (hasBabel) plugins.push('babel') 13 | if (env.node) plugins.push('node') 14 | 15 | if (settings.compat) plugins.push('compat') 16 | 17 | module.exports = plugins 18 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const adjunct = require('eslint-config-adjunct/configs') 2 | 3 | const checkMissing = require('./lib/missing') 4 | const showLoaded = require('./lib/loaded') 5 | const { hasAnyDep } = require('./lib/utils') 6 | 7 | const overridesRules = require('./rules/overrides') 8 | const configs = require('./detect/configs') 9 | const parsers = require('./detect/parsers') 10 | const plugins = require('./detect/plugins') 11 | 12 | const hasReact = hasAnyDep('react') 13 | 14 | // Workaround VS Code trying to run this file twice! 15 | if (!global.hasAutoConfigLoaded) { 16 | const airbnbDependentcies = ['import'] 17 | if (hasReact) airbnbDependentcies.push('jsx-a11y', 'react', 'react-hooks') 18 | 19 | checkMissing( 20 | [...airbnbDependentcies, ...adjunct.rules, ...plugins], 21 | adjunct.extraInstallPackage, 22 | configs, 23 | parsers 24 | ) 25 | 26 | showLoaded(airbnbDependentcies) 27 | 28 | global.hasAutoConfigLoaded = true 29 | } 30 | 31 | const autoConfig = { 32 | extends: [...parsers, ...plugins, ...configs].map((config) => 33 | require.resolve(`./rules/${config}`) 34 | ), 35 | ...overridesRules, 36 | } 37 | 38 | // console.log(autoConfig) 39 | 40 | module.exports = autoConfig 41 | -------------------------------------------------------------------------------- /lib/config.js: -------------------------------------------------------------------------------- 1 | const { cosmiconfigSync } = require('cosmiconfig') 2 | 3 | module.exports = cosmiconfigSync('eslint').search().config 4 | -------------------------------------------------------------------------------- /lib/hasPackage.js: -------------------------------------------------------------------------------- 1 | const { hasAnyDep } = require('./utils') 2 | const { settings = {} } = require('./config') 3 | 4 | const hasBabel = 5 | settings.babel || 6 | hasAnyDep('babel') || 7 | hasAnyDep('babel-core') || 8 | hasAnyDep('@babel/core') 9 | 10 | const hasTypeScript = settings.typescript || hasAnyDep('typescript') 11 | 12 | const hasReact = hasAnyDep('react') 13 | 14 | module.exports = { 15 | hasBabel, 16 | hasTypeScript, 17 | hasReact, 18 | } 19 | -------------------------------------------------------------------------------- /lib/is-module-available.js: -------------------------------------------------------------------------------- 1 | module.exports = function isModuleAvailable(name) { 2 | try { 3 | require.resolve(name) 4 | return true 5 | } catch (error) { 6 | return false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /lib/loaded.js: -------------------------------------------------------------------------------- 1 | const { CONFIG_NAME } = require('../constants') 2 | 3 | module.exports = function showLoaded(rules) { 4 | // eslint-disable-next-line no-console 5 | console.log(` 6 | ${CONFIG_NAME} loaded the following packages: 7 | 8 | ${rules.map((plugin) => `eslint-plugin-${plugin}`).join('\n ')}`) 9 | } 10 | -------------------------------------------------------------------------------- /lib/missing.js: -------------------------------------------------------------------------------- 1 | const { compose, includes, not, when } = require('ramda') 2 | 3 | const isModuleAvailable = require('./is-module-available') 4 | const { hasAnyDep } = require('./utils') 5 | 6 | const { CONFIG_NAME } = require('../constants') 7 | 8 | const ADJUCT = 'eslint-config-adjunct' 9 | 10 | const notIncludes = (str) => compose(not, includes(str)) 11 | const atLatest = when(notIncludes('@'), (pkg) => `${pkg}@latest`) 12 | 13 | const moduleNotAvailable = (pkg) => 14 | !isModuleAvailable(pkg.charAt(0) === '@' ? pkg : pkg.split('@')[0]) 15 | 16 | module.exports = function checkMissing( 17 | rules, 18 | extraInstallPackage, 19 | configs, 20 | parsers 21 | ) { 22 | const notInstalled = rules 23 | .map((plugin) => `eslint-plugin-${plugin}`) 24 | .filter((plugin) => moduleNotAvailable(plugin)) 25 | 26 | extraInstallPackage.forEach(([rule, plugin]) => { 27 | if (rules.includes(rule) && moduleNotAvailable(plugin)) { 28 | notInstalled.push(plugin) 29 | } 30 | }) 31 | 32 | configs 33 | .map((config) => 34 | config.charAt(0) === '@' ? config : `eslint-config-${config}` 35 | ) 36 | .filter((plugin) => moduleNotAvailable(plugin)) 37 | .forEach((config) => notInstalled.push(config)) 38 | 39 | parsers 40 | .filter((plugin) => moduleNotAvailable(plugin)) 41 | .forEach((parser) => notInstalled.push(parser)) 42 | 43 | if (!hasAnyDep(ADJUCT)) notInstalled.push(ADJUCT) 44 | 45 | if (notInstalled.length === 0) return 46 | 47 | const s = notInstalled.length === 1 ? '' : 's' 48 | 49 | // eslint-disable-next-line no-console 50 | console.log(` 51 | Oops! Something went wrong! :( 52 | 53 | ${CONFIG_NAME} could not find the following package${s} 54 | 55 | ${notInstalled.join('\n ')} 56 | 57 | To install the missing package${s}, please run the following command: 58 | 59 | npm install ${notInstalled.map((pkg) => atLatest(pkg)).join(' ')} --save-dev 60 | 61 | `) 62 | 63 | process.exit(1) // eslint-disable-line unicorn/no-process-exit 64 | } 65 | -------------------------------------------------------------------------------- /lib/utils.js: -------------------------------------------------------------------------------- 1 | // From kcd-scripts 2 | 3 | const fs = require('fs') 4 | const path = require('path') 5 | const rimraf = require('rimraf') 6 | const mkdirp = require('mkdirp') 7 | const arrify = require('arrify') 8 | const has = require('lodash/has') 9 | const readPkgUp = require('read-pkg-up') 10 | const { cosmiconfigSync } = require('cosmiconfig') 11 | 12 | const { packageJson: pkg, path: packagePath } = readPkgUp.sync({ 13 | // eslint-disable-next-line security/detect-non-literal-fs-filename 14 | cwd: fs.realpathSync(process.cwd()), 15 | }) 16 | 17 | const appDirectory = path.dirname(packagePath) 18 | 19 | const fromRoot = (...p) => path.join(appDirectory, ...p) 20 | 21 | // eslint-disable-next-line security/detect-non-literal-fs-filename 22 | const hasFile = (...p) => fs.existsSync(fromRoot(...p)) 23 | 24 | const hasPkgProp = (props) => arrify(props).some((prop) => has(pkg, prop)) // eslint-disable-line lodash-fp/no-extraneous-function-wrapping 25 | 26 | const hasPkgSubProp = (packageProp) => (props) => 27 | hasPkgProp(arrify(props).map((p) => `${packageProp}.${p}`)) 28 | 29 | const hasScript = hasPkgSubProp('scripts') 30 | const hasPeerDep = hasPkgSubProp('peerDependencies') 31 | const hasDep = hasPkgSubProp('dependencies') 32 | const hasDevDep = hasPkgSubProp('devDependencies') 33 | const hasAnyDep = (args) => 34 | [hasDep, hasDevDep, hasPeerDep].some((fn) => fn(args)) 35 | 36 | function environmentIsSet(name) { 37 | return ( 38 | Object.prototype.hasOwnProperty.call(process.env, name) && 39 | process.env[name] && 40 | process.env[name] !== 'undefined' 41 | ) 42 | } 43 | 44 | function parseEnv(name, def) { 45 | if (environmentIsSet(name)) { 46 | try { 47 | return JSON.parse(process.env[name]) 48 | } catch (error) { 49 | return process.env[name] 50 | } 51 | } 52 | return def 53 | } 54 | 55 | function uniq(array) { 56 | return [...new Set(array)] 57 | } 58 | 59 | function writeExtraEntry(name, { cjs, esm }, clean = true) { 60 | if (clean) { 61 | rimraf.sync(fromRoot(name)) 62 | } 63 | mkdirp.sync(fromRoot(name)) 64 | 65 | const packageJson = fromRoot(`${name}/package.json`) 66 | const entryDirectory = fromRoot(name) 67 | 68 | // eslint-disable-next-line security/detect-non-literal-fs-filename 69 | fs.writeFileSync( 70 | packageJson, 71 | JSON.stringify( 72 | { 73 | main: path.relative(entryDirectory, cjs), 74 | 'jsnext:main': path.relative(entryDirectory, esm), 75 | module: path.relative(entryDirectory, esm), 76 | }, 77 | null, 78 | 2 79 | ) 80 | ) 81 | } 82 | 83 | function hasLocalConfig(moduleName, searchOptions = {}) { 84 | const explorerSync = cosmiconfigSync(moduleName, searchOptions) 85 | const result = explorerSync.search(packagePath) 86 | 87 | return result !== null 88 | } 89 | 90 | module.exports = { 91 | appDirectory, 92 | fromRoot, 93 | hasFile, 94 | hasLocalConfig, 95 | hasPkgProp, 96 | hasScript, 97 | hasAnyDep, 98 | hasDevDep, 99 | parseEnv, 100 | pkg, 101 | uniq, 102 | writeExtraEntry, 103 | } 104 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-auto", 3 | "version": "0.9.0", 4 | "author": "David J. Bradshaw", 5 | "maintainers": [ 6 | { 7 | "name": "David J. Bradshaw", 8 | "email": "dave@bradshaw.net" 9 | } 10 | ], 11 | "description": "Automatically configure esLint based on project dependancies", 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/davidjbradshaw/eslint-config-auto.git" 16 | }, 17 | "main": "index.js", 18 | "scripts": { 19 | "ci-test": "npm run test", 20 | "eslint": "eslint --color *.{js,json,md} rules/** lib/**", 21 | "eslint:fix": "eslint --color --fix *.{js,md} rules/** lib/**", 22 | "eslint:print": "eslint --print-config ./tsconfig.json", 23 | "prepublishOnly": "eslint-find-rules --no-core", 24 | "test": "npm run eslint && npm run prepublishOnly" 25 | }, 26 | "keywords": [ 27 | "airbnb", 28 | "eslint", 29 | "eslint-config", 30 | "eslint-config-airbnb", 31 | "unicorn" 32 | ], 33 | "dependencies": { 34 | "arrify": "^2.0.1", 35 | "cosmiconfig": "^9.0.0", 36 | "eslint-config-adjunct": ">=4.13.0", 37 | "lodash": "^4.17.21", 38 | "mkdir": "0.0.2", 39 | "mkdirp": "^3.0.1", 40 | "ramda": "^0.29.1", 41 | "read-pkg-up": "7.0.1", 42 | "rimraf": "^5.0.5" 43 | }, 44 | "devDependencies": { 45 | "@babel/core": "^7.23.9", 46 | "@babel/eslint-parser": "^7.23.10", 47 | "eslint": "^8.56.0", 48 | "eslint-config-airbnb": "^19.0.4", 49 | "eslint-config-airbnb-babel": "^0.2.2", 50 | "eslint-config-airbnb-typescript": "^17.1.0", 51 | "eslint-config-prettier": "^9.1.0", 52 | "eslint-find-rules": "^4.1.0", 53 | "eslint-plugin-babel": "^5.3.1", 54 | "eslint-plugin-const-case": "^1.2.2", 55 | "eslint-plugin-eslint-comments": "^3.2.0", 56 | "eslint-plugin-html": "^8.0.0", 57 | "eslint-plugin-import": "^2.29.1", 58 | "eslint-plugin-json": "^3.1.0", 59 | "eslint-plugin-jsx-a11y": "^6.8.0", 60 | "eslint-plugin-lodash": "^7.4.0", 61 | "eslint-plugin-lodash-fp": "^2.2.0-a1", 62 | "eslint-plugin-markdown": "^3.0.1", 63 | "eslint-plugin-no-constructor-bind": "^2.0.4", 64 | "eslint-plugin-no-secrets": "^0.8.9", 65 | "eslint-plugin-no-unsanitized": "^4.0.2", 66 | "eslint-plugin-no-use-extend-native": "^0.5.0", 67 | "eslint-plugin-node": "^11.1.0", 68 | "eslint-plugin-optimize-regex": "^1.2.1", 69 | "eslint-plugin-pii": "^1.0.2", 70 | "eslint-plugin-prettier": "^5.1.3", 71 | "eslint-plugin-promise": "^6.1.1", 72 | "eslint-plugin-ramda": "^2.5.1", 73 | "eslint-plugin-react": "^7.33.2", 74 | "eslint-plugin-react-hooks": "^4.6.0", 75 | "eslint-plugin-react-native": "^4.1.0", 76 | "eslint-plugin-security": "^2.1.1", 77 | "eslint-plugin-simple-import-sort": "^12.0.0", 78 | "eslint-plugin-sonarjs": "^0.24.0", 79 | "eslint-plugin-switch-case": "^1.1.2", 80 | "eslint-plugin-unicorn": "^51.0.1", 81 | "eslint-plugin-xss": "^0.1.12", 82 | "husky": "^9.0.11", 83 | "in-publish": "^2.0.1", 84 | "prettier": "^3.2.5", 85 | "prettier-cli": "^0.1.0", 86 | "react": "^18.2.0", 87 | "react-native": "^0.73.4", 88 | "safe-publish-latest": "^2.0.0", 89 | "typescript": "^5.3.3" 90 | }, 91 | "engines": { 92 | "node": ">= 8.3" 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /rules/@babel/eslint-parser.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | overrides: [ 3 | { 4 | files: ['**.js', '**.jsx'], 5 | parser: '@babel/eslint-parser', 6 | parserOptions: { 7 | requireConfigFile: false, 8 | ecmaVersion: 2023, // Allows for the parsing of modern ECMAScript features 9 | sourceType: 'module', // Allows for the use of imports 10 | }, 11 | }, 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /rules/@typescript-eslint/eslint-plugin.js: -------------------------------------------------------------------------------- 1 | const configs = [ 2 | 'plugin:@typescript-eslint/recommended', 3 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', 4 | ] 5 | 6 | // eslint-disable-next-line no-console 7 | console.log(configs.map((config) => ` ${config.split(':')[1]}`).join('\n')) 8 | 9 | module.exports = { 10 | overrides: [ 11 | { 12 | files: ['*.ts', '*.tsx', '*.d.ts'], 13 | extends: configs, 14 | parser: '@typescript-eslint/parser', 15 | }, 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /rules/@typescript-eslint/parser.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | overrides: [ 3 | { 4 | files: ['**.ts', '**.tsx'], 5 | parser: '@typescript-eslint/parser', 6 | parserOptions: { 7 | project: './tsconfig.json', 8 | }, 9 | }, 10 | ], 11 | } 12 | -------------------------------------------------------------------------------- /rules/adjunct.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-config-adjunct') 3 | 4 | module.exports = { 5 | extends: ['adjunct'], 6 | } 7 | -------------------------------------------------------------------------------- /rules/airbnb-babel.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-config-airbnb-babel') 3 | 4 | module.exports = { 5 | extends: ['airbnb-babel'], 6 | } 7 | -------------------------------------------------------------------------------- /rules/airbnb-base.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-config-airbnb-base') 3 | 4 | module.exports = { 5 | extends: ['airbnb-base'], 6 | } 7 | -------------------------------------------------------------------------------- /rules/airbnb-typescript.js: -------------------------------------------------------------------------------- 1 | const { hasAnyDep } = require('../lib/utils') 2 | 3 | const hasReact = hasAnyDep('react') 4 | const configs = hasReact ? ['airbnb-typescript'] : ['airbnb-typescript/base'] 5 | 6 | // eslint-disable-next-line no-console 7 | console.log(configs.map((config) => ` eslint-config-${config}`).join('\n')) 8 | 9 | module.exports = { 10 | overrides: [ 11 | { 12 | files: ['*.ts', '*.tsx'], 13 | extends: configs, 14 | rules: { 15 | '@typescript-eslint/naming-convention': 'off', // conflicts with unicorn 16 | '@typescript-eslint/explicit-function-return-type': [ 17 | 'error', 18 | { 19 | allowExpressions: true, 20 | allowTypedFunctionExpressions: true, 21 | allowHigherOrderFunctions: true, 22 | allowConciseArrowFunctionExpressionsStartingWithVoid: true, 23 | }, 24 | ], 25 | }, 26 | }, 27 | ], 28 | } 29 | -------------------------------------------------------------------------------- /rules/airbnb.js: -------------------------------------------------------------------------------- 1 | const isModuleAvailable = require('../lib/is-module-available') 2 | 3 | const HOOKS = 'airbnb/hooks' 4 | const configs = ['airbnb'] 5 | 6 | if (isModuleAvailable(`eslint-config-${HOOKS}`)) configs.push(HOOKS) 7 | else { 8 | // eslint-disable-next-line no-console 9 | console.warn( 10 | ' \u001B[33mOutdated version of eslint-config-airbnb detected, please upgrade to support React Hooks\u001B[0m' 11 | ) 12 | } 13 | 14 | // eslint-disable-next-line no-console 15 | console.log(configs.map((config) => ` eslint-config-${config}`).join('\n')) 16 | 17 | module.exports = { 18 | extends: configs, 19 | rules: { 20 | 'react/jsx-no-constructed-context-values': 0, 21 | 'react/no-unstable-nested-components': 0, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /rules/babel.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-plugin-babel') 3 | 4 | module.exports = { 5 | plugins: ['babel'], 6 | } 7 | -------------------------------------------------------------------------------- /rules/compat.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-plugin-compat') 3 | 4 | module.exports = { 5 | extends: ['plugin:compat/recommended'], 6 | } 7 | -------------------------------------------------------------------------------- /rules/node.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-plugin-node') 3 | 4 | module.exports = { 5 | overrides: [ 6 | { 7 | files: ['*.js', '**/*.js'], 8 | extends: ['plugin:node/recommended'], 9 | rules: { 10 | 'node/no-unsupported-features/es-syntax': 'off', 11 | 12 | // Rules not in recomended config 13 | 'node/callback-return': 'off', 14 | 'node/exports-style': 'off', 15 | 'node/file-extension-in-import': 'off', 16 | 'node/global-require': 'off', 17 | 'node/handle-callback-err': 'off', 18 | 'node/no-callback-literal': 'off', 19 | 'node/no-mixed-requires': 'off', 20 | 'node/no-new-require': 'off', 21 | 'node/no-path-concat': 'off', 22 | 'node/no-process-env': 'off', 23 | 'node/no-process-exit': 'off', 24 | 'node/no-restricted-import': 'off', 25 | 'node/no-restricted-require': 'off', 26 | 'node/no-sync': 'off', 27 | 'node/prefer-global/buffer': 'off', 28 | 'node/prefer-global/console': 'off', 29 | 'node/prefer-global/process': 'off', 30 | 'node/prefer-global/text-decoder': 'off', 31 | 'node/prefer-global/text-encoder': 'off', 32 | 'node/prefer-global/url': 'off', 33 | 'node/prefer-global/url-search-params': 'off', 34 | 'node/prefer-promises/dns': 'off', 35 | 'node/prefer-promises/fs': 'off', 36 | }, 37 | }, 38 | ], 39 | } 40 | -------------------------------------------------------------------------------- /rules/overrides.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'react/jsx-props-no-spreading': 'off', 4 | }, 5 | overrides: [ 6 | { 7 | files: ['*.tsx'], 8 | rules: { 9 | 'react/prop-types': 'off', 10 | }, 11 | }, 12 | { 13 | files: ['*.d.ts'], 14 | rules: { 15 | 'import/order': 'off', 16 | }, 17 | }, 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /rules/react-native.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-console 2 | console.log(' eslint-plugin-react-native') 3 | 4 | module.exports = { 5 | extends: ['plugin:react-native/all'], 6 | plugins: ['react-native'], 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "ES2017" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, 6 | "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, 7 | // "lib": [], /* Specify library files to be included in the compilation. */ 8 | // "allowJs": true, /* Allow javascript files to be compiled. */ 9 | // "checkJs": true, /* Report errors in .js files. */ 10 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 11 | "declaration": true /* Generates corresponding '.d.ts' file. */, 12 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 13 | "sourceMap": true /* Generates corresponding '.map' file. */, 14 | // "outFile": "./", /* Concatenate and emit output to single file. */ 15 | "outDir": "dist" /* Redirect output structure to the directory. */, 16 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 17 | // "composite": true, /* Enable project compilation */ 18 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 19 | // "removeComments": true, /* Do not emit comments to output. */ 20 | // "noEmit": true, /* Do not emit outputs. */ 21 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 22 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 23 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 24 | 25 | /* Strict Type-Checking Options */ 26 | "strict": true /* Enable all strict type-checking options. */, 27 | "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, 28 | // "strictNullChecks": true, /* Enable strict null checks. */ 29 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | 35 | /* Additional Checks */ 36 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 37 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 38 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 39 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 40 | "allowUnreachableCode": false, 41 | 42 | /* Module Resolution Options */ 43 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 44 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 45 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 46 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 47 | // "typeRoots": [], /* List of folders to include type definitions from. */ 48 | // "types": [], /* Type declaration files to be included in compilation. */ 49 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 50 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, 51 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 52 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 53 | 54 | /* Source Map Options */ 55 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 56 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 57 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 58 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 59 | 60 | /* Experimental Options */ 61 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 62 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 63 | 64 | /* Advanced Options */ 65 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 66 | }, 67 | "include": ["src", "examples"] 68 | } 69 | --------------------------------------------------------------------------------