Skip to content

tjw-lint/eslint-config-tjw-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-config-tjw-import

The Jared Wilcurt's strict ESLint rules for importing files.

Using this

  1. npm install --save-dev eslint-plugin-import eslint-config-tjw-import
  2. In your .eslitrc.js add tjw-import to your extends like so:
    module.exports = {
      extends: [
        'tjw-import'
      ]
    };

Vite/Webpack aliases

You may optionally want to add in an import resolver if you use Vite or Webpack for aliasing. The below code says "webpack" but works for both.

npm install --save-dev eslint-import-resolver-webpack

// .eslintrc.js
const path = require('path');

module.exports = {
  extends: [
    'tjw-import'
  ],
  settings: {
    'import/resolver': {
      webpack: {
        config: {
          resolve: {
            alias: {
              '@': path.resolve('src'),
              '@@': path.resolve('tests'),
              '@@@': path.resolve('docs')
            }
          }
        }
      }
    }
  }
};

See also: