Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(template/typescript-webpack): add ts/tsx to known eslint-plugin-import extensions #2139

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

malept
Copy link
Member

@malept malept commented Jan 28, 2021

Summarize your changes:

Adds .ts / .tsx to the list of resolver node extensions to get rid of a lint error by default.

Closes electron-forge/electron-forge-docs#28

@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Merging #2139 (169c962) into master (646c159) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2139   +/-   ##
=======================================
  Coverage   72.71%   72.71%           
=======================================
  Files          74       74           
  Lines        2221     2221           
  Branches      420      420           
=======================================
  Hits         1615     1615           
  Misses        446      446           
  Partials      160      160           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 646c159...169c962. Read the comment docs.

@malept malept merged commit 90f122c into master Jan 29, 2021
@malept malept deleted the malept/fix/typescript-webpack/eslint-import-resolver branch January 29, 2021 02:47
@ivancuric
Copy link

ivancuric commented Feb 3, 2021

This is the wrong fix. The solution is to include "plugin:import/typescript" which includes these rules and some more:

/**
 * Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
 */

const allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];

module.exports = {

  settings: {
    'import/extensions': allExtensions,
    'import/external-module-folders': ['node_modules', 'node_modules/@types'],
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
    },
    'import/resolver': {
      'node': {
        'extensions': allExtensions,
      },
    },
  },

  rules: {
    // analysis/correctness

    // TypeScript compilation already ensures that named imports exist in the referenced module
    'import/named': 'off',
  },
};

The PR submitter didn't have it enabled in their config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants