rome / tools

Unified developer tools for JavaScript, TypeScript, and the web
https://docs.rome.tools/
MIT License
23.75k stars 659 forks source link

šŸ› `rome.json` takes not effects #4206

Closed Soltus closed 1 year ago

Soltus commented 1 year ago

Environment information

CLI:
  Version:              11.0.0
  Color support:        true

Platform:
  CPU Architecture:     x86_64
  OS:                   windows

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 unset

Rome Configuration:
  Status:               loaded
  Formatter disabled:   false
  Linter disabled:      false

Workspace:
  Open Documents:       0

Discovering running Rome servers...

Incompatible Rome Server: ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”

i Rage discovered this running server using an incompatible version of Rome.

Server:
  Version:              <=10.0.0

What happened?

{
  "$schema": "./node_modules/rome/configuration_schema.json",
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentSize":2,
    "lineWidth": 120,
    "formatWithErrors": true
  },
  "javascript":{
    "formatter": {
      "quoteStyle": "single"
    }
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "suspicious": {
        "noExplicitAny": "off"
      }
    }
  }
}

The above configuration does not work. I can only comment in the code // rome-ignore lint/suspicious/noExplicitAny:

Expected result

rome.json takes effects

Code of Conduct

Soltus commented 1 year ago

image According to CI, it seems to be a unique problem with the Windows platform

ematipico commented 1 year ago

@Soltus, could you please share more info regarding where/when you have this issue? (CLI, VSCode extension, etc.)

The CI fail doesn't reflect the issue you're having, the CI fails on code that is not currently released, so it should not worry you.

Conaclos commented 1 year ago

I noticed the same issue with the latest pre-release (11.0.0-nightly.97e48b4). This affects the CLI and the VSCode extension.

This is a regression because I had no problem with the CLI in the previous pre-release (11.0.0-nightly.fab5440). Note that I did not test the VSCode extension in its previous pre-release.

Output of rome rage:

CLI:
  Version:              11.0.0-nightly.97e48b4
  Color support:        true

Platform:
  CPU Architecture:     x86_64
  OS:                   linux

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"
  JS_RUNTIME_VERSION:   "v18.12.0"
  JS_RUNTIME_NAME:      "node"
  NODE_PACKAGE_MANAGER: "npm/8.19.2"

Rome Configuration:
  Status:               Loaded successfully
  Formatter disabled:   false
  Linter disabled:      false

Workspace:
  Open Documents:       0

Discovering running Rome servers...

rome server output (for the VSCode extension):

[cli-stdout] data 40
[cli] exit 0
Connecting to "/tmp/rome-socket-11.0.0-nightly.97e48b4" ...
[Info  - 1:02:18 PM] Server initialized with PID: 160684
Soltus commented 1 year ago

First of all, I run pnpm add --save-dev rome on the root path of the project image

Then execute the pnpm rome init, and then manually modifyrome.json

Then I installed the official VSCode extension image @Conaclos mentioned the VSCode extension preview, I switched to the preview version, I don't know if it has an impact, but I switched back to the official version and also reinstalled

This is the screenshot of Linter: image

I tried to uninstall the ROME package, and then VSCODE issued a path warning, but did not affect the VSCode extension . Linter still reported an error as the picture above. image

ematipico commented 1 year ago

Would you be able to reproduce the issue in a fresh new repository and share it here? Or share the one where you're working on? Unfortunately, I can't replicate the issue. It could be an OS issue since I am using macOS while the case is happing on windows.

Soltus commented 1 year ago

Wait a minute, I'll ask a friend to help test it out

Soltus commented 1 year ago
 "noExplicitAny": "off"

My friend said that he worked normally on macos Is it a path problem?

Conaclos commented 1 year ago

Strangely I did not get the issue if I used a built version from the source.

Soltus commented 1 year ago

The absolute path of my local project contains Chinese characters, will this affect?

fanzeyi commented 1 year ago

FYI I figured out in my case, it was because I had the TypeScript project as one of the directories in the workspace but not the top one. Rome doesn't seem to be able to see rome.json in the directory if it is not the top directory (first in the list).

Rearranging directories order in my VS Code workspace helped.

Soltus commented 1 year ago

yeah, i will confirm it later. thank you

Soltus commented 1 year ago

That's right, rome.json is put in effect at the root path of the workspace