Comments (13)
@coderaiser Thanks for your response! Yes, of course, I plan to do it on Tuesday. I also plan to try to build Putout on my own. I will also try to run it on my other laptop with Windows 11. I will get back to you once I manage to explore a bit more details. Thank you for the search link π
from putout.
Just fixed similar bug in πPutout v35.35.5. Could you please tell me if it works for you?
from putout.
Could you please try to pass β-raw
flag when running πPutout and check ~/.putout.json
in your home directory, looks like issue with configuration file, but Iβm not sure what exactly issue is.
from putout.
Looks like picomatch
works differently on win
and unix
. I don't know what the problem with name.startsWith
but π No processors found for test.js
fixed in v35.35.6 π and should work good. Is it works for you?
from putout.
Looks like name.startsWith is not a function
is pnpm
-specific issue. Try to use bun
to install dependencies. Also you can create issue in pnpm
repository.
from putout.
I cannot reproduce this with pnpm
:
coderaiser@localcmd:~/putout$ cat > 1.js
const a = 'hello';
^C
coderaiser@localcmd:~/putout$ pnpm dlx putout@latest 1.js
1.js
1:6 error 'a' is defined but never used remove-unused-variables
β 1 errors in 1 files
fixable with the `--fix` option
If you have any ideas how to reproduce - you can send PR with test, I'll merge so it work for your case.
from putout.
Could you please provide an example of broken config? Just copied putout.json
from monorepo and still cannot reproduce. Maybe link to minimal repository can help.
from putout.
I suggest you to always install πPutout as devDependency
, if you install it as global, and run it as global, additional processors (like @putout/processor-typescript
) should be also installed globally. devDependency
is convinient and recommended way to install and run πPutout.
from putout.
Hi, thank you!
I cannot reproduce this:
coderaiser@localcmd:~/Amber$ cat > 1.js
var a = 5;
^C
coderaiser@localcmd:~/Amber$ npx putout 1.js
1.js
1:4 error 'a' is defined but never used remove-unused-variables
β 1 errors in 1 files
fixable with the `--fix` option
but there is a couple places where bug can occur: https://github.com/search?q=repo%3Acoderaiser%2Fputout%20name.startsWith&type=code.
Could you please provide more details? Maybe you can add console.log
to identify problem place?
from putout.
devDependencies:
- putout 35.35.4
+ putout 35.35.5
> pnpm putout test.js
π name.startsWith is not a function
> pnpm dlx putout@latest test.js
π name.startsWith is not a function
> npm run putout test.js
π name.startsWith is not a function
> npx putout@latest test.js
π name.startsWith is not a function
// without .putout.json
npx putout@latest test.js
π No processors found for test.js
bun add -D putout@latest
installed [email protected] with binaries: putout
> bun putout index.js
$ putout index.js
π name.startsWith is not a function
error: script "putout" exited with code 9
bun without .putout.json
bun add -D putout@latest
installed [email protected] with binaries: putout
> bun putout index.js
$ putout index.js
node:internal/event_target:1094
process.nextTick(() => { throw err; });
^
Error: Cannot find module './url'
Require stack:
- C:\B\S\putout-minimal-repro\node_modules\source-map\lib\util.js
- C:\B\S\putout-minimal-repro\node_modules\source-map\lib\source-map-generator.js
- C:\B\S\putout-minimal-repro\node_modules\source-map\source-map.js
- C:\B\S\putout-minimal-repro\node_modules\recast\lib\util.js
- C:\B\S\putout-minimal-repro\node_modules\recast\lib\options.js
- C:\B\S\putout-minimal-repro\node_modules\recast\lib\parser.js
- C:\B\S\putout-minimal-repro\node_modules\recast\main.js
- C:\B\S\putout-minimal-repro\node_modules\@putout\engine-parser\lib\print.js
- C:\B\S\putout-minimal-repro\node_modules\@putout\engine-parser\lib\parser.js
- C:\B\S\putout-minimal-repro\node_modules\putout\lib\putout.js
- C:\B\S\putout-minimal-repro\node_modules\putout\lib\cli\process-file.js
- C:\B\S\putout-minimal-repro\node_modules\putout\lib\cli\runner\runner.js
- C:\B\S\putout-minimal-repro\node_modules\putout\lib\cli\index.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Function._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (C:\B\S\putout-minimal-repro\node_modules\source-map\lib\util.js:8:13)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Object..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Function._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:326:10)
at [kOnMessage] (node:internal/worker:337:37)
at MessagePort.<anonymous> (node:internal/worker:232:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\B\\S\\putout-minimal-repro\\node_modules\\source-map\\lib\\util.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\source-map\\lib\\source-map-generator.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\source-map\\source-map.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\recast\\lib\\util.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\recast\\lib\\options.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\recast\\lib\\parser.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\recast\\main.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\@putout\\engine-parser\\lib\\print.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\@putout\\engine-parser\\lib\\parser.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\putout\\lib\\putout.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\putout\\lib\\cli\\process-file.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\putout\\lib\\cli\\runner\\runner.js',
'C:\\B\\S\\putout-minimal-repro\\node_modules\\putout\\lib\\cli\\index.js'
]
}
Node.js v20.15.0
error: script "putout" exited with code 1
from putout.
I couldn't find .putout.json
in my C:\Users\blefn
home folder, subfolders there doesn't has this file as well. I just tried to create such a file myself, but unfortunately, the result is the same, with and without --raw
flag.
> pnpm putout test.js --raw || pnpm dlx putout test.js --raw || npx putout test.js --raw
π name.startsWith is not a function
error: "putout.cmd" exited with code 9
from putout.
Yeah, hooray! This almost resolved the issue! π
Now putout
works successfully as long as the putout
dependency is not installed.
devDependencies:
- putout 35.35.6
However, if it is installed, it seems to "think" that it is part of the original monorepo and expects all its dependencies to be in the project, and since they are not, we get π No processors found for test.js
(or also π name.startsWith is not a function
).
So, theoretically, if all the necessary dependencies are installed, it should work. Maybe itβs necessary to add some peer dependencies to package.json
binaries for putout
? I mean, so that all the necessary dependencies of putout
are installed together with putout
. Or, is this already being done?
So currently, as a temporary solution, I added the following to scripts
of package.json
file: "putout": "pnpm dlx putout@latest"
, which makes pnpm putout test.js
work successfully. This works both with and without a config.
upd. It turned out π name.startsWith is not a function
is still present if .putout.json
contains "formatter": [{ "minCount": 10 }, "progress-bar" ]
. This happens even with pnpm dlx putout@latest
.
It also turned out that when using pnpm dlx putout@latest
, it is impossible to install custom processors. For example, when using "processors": ["javascript", "typescript"]
, I get π Cannot find package 'putout-processor-typescript'
, even though @putout/processor-typescript
is installed. I have a theory that the config tries to refer to the putout
library first, but it is not installed locally. Or maybe the problem is that it searches for the dependency "putout-processor-typescript" while the actual package is named @putout/processor-typescript
? Hmm... π€
p.s. I also tried testing putout
on Linux Mint, and to my great surprise, it turned out that π name.startsWith is not a function
is not a Windows-specific issue; it is also present on Linux (and presumably on macOS, I guess).
upd. So strange, but it seems that everything works now when "formatter": [{ "minCount": 10 }, "progress-bar" ]
is set. So this specific issue may be was solved.
from putout.
I have completed the investigation. It turned out that the latest issues were due to the fact that if there is a key-value pair in .putout.json
that expects the presence of another key-value pair but does not find it, a problem occurs. That's why the formatter worked for me in the end, as I copy-pasted the entire putout.json
from your monorepo. This issue also arises if there is incorrect sorting of key-value pairs. As a solution, a .js/.ts/.mjs config could be implemented in addition to json. So issue is not related to specific package manager or OS.
from putout.
Related Issues (20)
- ignore test files HOT 5
- path is missing for ruler toggler HOT 2
- babel config is not loaded. HOT 13
- how to run just specific rules HOT 1
- putout ignores camelCased paths HOT 1
- Using async functions in replacer HOT 6
- Mistaken removal of semi from unnamed prop types in FC HOT 12
- @putout/printer: Removed useful comma in TS HOT 6
- How to use indetifier name as a string? HOT 4
- It it possible to use Putout as Eslint backend? HOT 1
- remove-unused-expressions: "use client" false warning HOT 2
- ESLint integration fail HOT 4
- Option to configure printer overrides from HOT 10
- doesn't work with yarn 4 and pnp HOT 2
- does more than asked for HOT 3
- Closing arrow bracket (>) inside React components should not be transformed into `>` automatically HOT 1
- `npm install` broken due to eslint shenanigans HOT 1
- how to remove "yield" HOT 10
- `eslint-plugin-putout` with ESLint flat config HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from putout.