Git Product home page Git Product logo

Comments (7)

austinrivas avatar austinrivas commented on May 2, 2024 2

@surmaaa adding node.extensions to my settings seems to have resolved the issue for me also.

My updated eslintrc.js settings object now looks like this:

settings: {
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx'],
    },
    'import/resolver': {
      node: {
        extensions: ['.js', '.jsx', '.ts', '.tsx']
      },
      webpack: {
        config: './internals/webpack/webpack.prod.babel.js',
      },
      typescript: {
        alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
        directory: './tsconfig.json',
      },
    },
    'import/ignore': ['types'], // Weirdly eslint cannot resolve exports in types folder (try removing this later)
  },

from react-boilerplate-typescript.

austinrivas avatar austinrivas commented on May 2, 2024

I am also experiencing this issue when running npm run lint directly from the command line.

I have noticed that the module resolution is incorrect as it is routing internals into node_modules/react-redux.

I have also noticed that this issue begins to manifest when you have multiple copies of react-boilerplate-typescript in the same project.

For instance I am using lerna to manage my monorepo, but I have been able to reproduce the error by creating a repo and cloning react-boilerplate-typescript into two sub directories and removing their .git directories.

It also seems to manifest when sharing a project directory with any other node app that has node_modules.

I haven't had the time to dig too deeply into this, and have managed to work around it for now, but I am afraid that it is a sign of a deeper issue with dependency linking and module resolution.

Any insight into this would be very appreciated.

code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint-import-resolver-webpack/index.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint-module-utils/resolve.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint-plugin-import/lib/index.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/lib/cli-engine/config-array-factory.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/lib/cli-engine/cli-engine.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/lib/cli-engine/index.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/lib/cli.js',
    '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/eslint/bin/eslint.js'
  ]
}
Error: Cannot find module '/home/austin/Workspace/Sophia/sophia-iot/frontend/node_modules/react-redux/internals/webpack/webpack.prod.babel.js'

from react-boilerplate-typescript.

Can-Sahin avatar Can-Sahin commented on May 2, 2024

Hmm interesting. @surmaaa does npm run lint works fine for you? If it does then I think its related to eslint in webstorm, because I am using vscode and had no problem.

Adding ts files to node extensions is a fix it seems. eslint-import-resolver-typescript is used and I thought that does the trick for finding ts files. I'll look into this.

from react-boilerplate-typescript.

Surm4 avatar Surm4 commented on May 2, 2024

Hmm interesting. @surmaaa does npm run lint works fine for you? If it does then I think its related to eslint in webstorm, because I am using vscode and had no problem.

Adding ts files to node extensions is a fix it seems. eslint-import-resolver-typescript is used and I thought that does the trick for finding ts files. I'll look into this.

I didn't check because I installed eslint-loader and it works fine.
However I checked npm run lint and it failed on lint:css so I changed script line to "stylelint \"./app/**/*.{js,ts,tsx}\"" but now it fails on "lint:eslint:quiet what's strange I have proper errors from es-lint loader in browser and there it's not failing
Imgur

from react-boilerplate-typescript.

Surm4 avatar Surm4 commented on May 2, 2024

Hmm interesting. @surmaaa does npm run lint works fine for you? If it does then I think its related to eslint in webstorm, because I am using vscode and had no problem.
Adding ts files to node extensions is a fix it seems. eslint-import-resolver-typescript is used and I thought that does the trick for finding ts files. I'll look into this.

I didn't check because I installed eslint-loader and it works fine.
However I checked npm run lint and it failed on lint:css so I changed script line to "stylelint \"./app/**/*.{js,ts,tsx}\"" but now it fails on "lint:eslint:quiet what's strange I have proper errors from es-lint loader in browser and there it's not failing
Imgur

I copied a command from lint:eslint:quiet and paste it into the console, there is no error so error above is just exit?
image

from react-boilerplate-typescript.

Surm4 avatar Surm4 commented on May 2, 2024

Eslint works for me I've had a problem with husky too so I had to reinstall it with cmd run as administrator (windows) so I think adding .ts and .tsx extensions to fix this error is enough

from react-boilerplate-typescript.

Can-Sahin avatar Can-Sahin commented on May 2, 2024

fixed in #71

from react-boilerplate-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.