|
| 1 | +/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\ |
| 2 | +
|
| 3 | + ESLINT CONFIGURATION for NETCREATE ITEST (2023) |
| 4 | +
|
| 5 | +\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/ |
| 6 | + |
| 7 | +const { RULES } = require('./.eslintrc-rules'); |
| 8 | + |
| 9 | +/// BASE CONFIGURATION //////////////////////////////////////////////////////// |
| 10 | +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 11 | +const config = { |
| 12 | + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*: |
| 13 | + We want to support both node-style 'require' and es6 module 'import'. |
| 14 | + :*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 15 | + env: { |
| 16 | + browser: true, |
| 17 | + es6: true, |
| 18 | + node: true |
| 19 | + }, |
| 20 | + plugins: ['react', '@typescript-eslint', 'import'], |
| 21 | + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*: |
| 22 | + Important: We use the official typescript-eslint/parser instead of the |
| 23 | + default espree parser. This supercedes TSLINT as of 2019, and is supported |
| 24 | + both by the Microsoft and ESLint teams. |
| 25 | +
|
| 26 | + The typescript parser handles the typescript superset syntax and creates a |
| 27 | + compatible AST for ESLINT. |
| 28 | + :*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 29 | + parser: '@typescript-eslint/parser', |
| 30 | + ignorePatterns: ['**/_dist/*', '**/node_modules/*'], |
| 31 | + parserOptions: { |
| 32 | + 'ecmaVersion': 2022, |
| 33 | + 'sourceType': 'module' |
| 34 | + }, |
| 35 | + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*: |
| 36 | + Plugins are packages that rules and sets of rules, but could also be |
| 37 | + something else (e.g. parser) that ESLINT can make use of. |
| 38 | + See: eslint.org/docs/user-guide/configuring#use-a-plugin |
| 39 | + :*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 40 | + extends: [ |
| 41 | + 'eslint:recommended', // standard recommendations |
| 42 | + 'plugin:react/recommended', // handle jsx syntax |
| 43 | + 'plugin:@typescript-eslint/eslint-recommended', // basic typescript rules |
| 44 | + 'prettier' // prettier overrides |
| 45 | + ], |
| 46 | + globals: { |
| 47 | + Atomics: 'readonly', |
| 48 | + SharedArrayBuffer: 'readonly' |
| 49 | + }, |
| 50 | + settings: { |
| 51 | + 'react': { |
| 52 | + 'version': 'detect' |
| 53 | + } |
| 54 | + }, |
| 55 | + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*: |
| 56 | + The "rules" field can override what was set in the "extends" field. |
| 57 | + I am turning off the rules that I find annoying or trigger false warnings |
| 58 | + in some code structures. |
| 59 | + :*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ |
| 60 | + rules: RULES |
| 61 | +}; |
| 62 | + |
| 63 | +/// EXPORTS /////////////////////////////////////////////////////////////////// |
| 64 | +/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 65 | +module.exports = config; |
0 commit comments