Skip to content

Instantly share code, notes, and snippets.

@phatnguyenuit
Created May 2, 2022 13:49
Show Gist options
  • Save phatnguyenuit/8ce9c3b6c554d9400bc97e1fe0249cc0 to your computer and use it in GitHub Desktop.
Save phatnguyenuit/8ce9c3b6c554d9400bc97e1fe0249cc0 to your computer and use it in GitHub Desktop.

Revisions

  1. phatnguyenuit created this gist May 2, 2022.
    41 changes: 41 additions & 0 deletions .eslintrc.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    module.exports = {
    // <--! Previous configuration comes here !-->

    plugins: ['@typescript-eslint', 'prettier', 'import'], // Add "import" plugin
    extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',

    // Extends two more configuration from "import" plugin
    'plugin:import/recommended',
    'plugin:import/typescript',
    ],
    rules: {
    // <--! Previous rules come here !-->

    // turn on errors for missing imports
    'import/no-unresolved': 'error',
    // 'import/no-named-as-default-member': 'off',
    'import/order': [
    'error',
    {
    groups: [
    'builtin', // Built-in imports (come from NodeJS native) go first
    'external', // <- External imports
    'internal', // <- Absolute imports
    ['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together
    'index', // <- index imports
    'unknown', // <- unknown
    ],
    'newlines-between': 'always',
    alphabetize: {
    /* sort in ascending order. Options: ["ignore", "asc", "desc"] */
    order: 'asc',
    /* ignore case. Options: [true, false] */
    caseInsensitive: true,
    },
    },
    ],
    }
    };