Giter Site home page Giter Site logo

eslint-cjs-to-esm's Issues

Specifying tsconfig in the project's .eslintrc.cjs raises parsing errors.

This library references the project's .eslintrc.cjs to run eslint.
Therefore, it may cause errors depending on the project's configuration.

Current behavior

The following command shows that this library runs eslint with reference to the project's .eslintrc.cjs.

npx eslint-cjs-to-esm --print-config  "./src/**/*.{js,ts}"

Some projects may specify tsconfig in parserOptions of .eslintrc.cjs.
https://typescript-eslint.io/linting/typed-linting/#specifying-tsconfigs

module.exports = {
    extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/recommended-type-checked',
    ],
    plugins: ['@typescript-eslint'],
    parser: '@typescript-eslint/parser',
    parserOptions: {
        project: './tsconfig.json',
    },
    root: true,
};

It causes errors.

PS C:\path\to\repository> npx eslint-cjs-to-esm "./src/index.ts"

C:\path\to\repository\src\index.ts
  0:0  error  Parsing error: Cannot read file 'c:\path\to\repository\node_modules\eslint-cjs-to-esm\tsconfig.json'

โœ– 1 problem (1 error, 0 warnings)

Proposal

The project's .eslintrc.js should be ignored or command line options should be noted in README.md.

npx eslint-cjs-to-esm --no-eslintrc --no-inline-config "./src/**/*.{js,ts}" 
  • --no-eslintrc: Disables use of configuration from .eslintrc.* and package.json files.
  • --no-inline-config: This option prevents inline comments like /*eslint-disable*/ or /*global foo*/ from having any effect.
    • This is to avoid errors caused by comments that disable unloaded rules.
    // eslint-disable-next-line non-existing-rule
    C:\path\to\repository\index.ts
    1:1  error  Definition for rule 'non-existing-rule' was not found  non-existing-rule

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @typescript-eslint/parser ^6.21.0
  • eslint-import-resolver-typescript ^3.6.1
  • eslint-plugin-file-extension-in-import-ts ^2.1.0
  • eslint-plugin-import ^2.29.1
  • eslint-plugin-node ^11.1.0
  • eslint-plugin-unicorn ^51.0.1
  • execa ^8.0.1
  • expected-exit-status ^3.1.0
  • npm 10.8.0

  • Check this box to trigger a request for Renovate to run again on this repository

Not working on Windows 10

I got an error on my Windows 10 computer when I tried to run eslint.

PS C:\path\to\repository> npx eslint-cjs-to-esm "./src/**/*.{js,ts}"
C:\path\to\repository\node_modules\.bin\eslint:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.0

An error is occurring in the execution of the eslint sh file.

https://github.com/azu/eslint-cjs-to-esm/blob/main/eslint-cjs-to-esm.js#L6

I am not familiar with how eslint or npm bin works, but it seems that on Windows bat files are used instead of sh files.

image

Similar Issues:

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.