azu / eslint-cjs-to-esm Goto Github PK
View Code? Open in Web Editor NEWESLint wrapper for migration from CJS to ESM.
License: MIT License
ESLint wrapper for migration from CJS to ESM.
License: MIT License
This library references the project's .eslintrc.cjs to run eslint.
Therefore, it may cause errors depending on the project's configuration.
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)
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}"
.eslintrc.*
and package.json
files./*eslint-disable*/
or /*global foo*/
from having any effect.
// 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
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@typescript-eslint/parser
, eslint-plugin-unicorn
).github/workflows/test.yml
actions/checkout v4
actions/setup-node v4
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
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.
Similar Issues:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.