Open ffMathy opened 6 months ago
@IWANABETHATGUY Can you help a little bit with this one, we may need more debug prints and guides.
I think what you mean is that you cannot configure the vscode extension to enable or disable any rules
you cannot mimic this functionality in vscode: npx oxlint@latest --tsconfig tsconfig.json -D all
other than redefining a n .eslintrc.json
file with the rules you want enabled.
I really feel that this makes a case for an oxc-specific configuration file, even though there's a fundamental decision that this is a no-configuration library.
Having looked at Biome, migration is harder from eslint to biome - if oxc would capitalize on its position where portability from eslint to Oxc is much simpler, and explicitely write to a configuration file, this tool would take off much more.
I will write a vision statement for that
VSCode support is incomplete and any help is appreciated.
We need:
Tracing with invalid configuration (see #3217 ) i got these errors
.vscode/settings.json
{
"oxc_language_server.enable": true,
"oxc_language_server.configPath": "eslint.config.js",
"oxc_language_server.run": "onSave"
}
Trace output
[2024-05-09T22:10:20Z INFO oxc_language_server] initialize: Options { run: OnSave, enable: true, config_path: "eslint.config.js" }
[2024-05-09T22:10:20Z INFO oxc_language_server] language server version: "0.0.1"
thread 'main' panicked at crates/oxc_language_server/src/main.rs:351:18:
should have initialized linter with new options: x Failed to parse jsonc file "/Users/dalisoft/Desktop/ignore_folder/
| test/test-backend/eslint.config.js"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error - 3:10:20 AM] Server process exited with signal SIGABRT.
[Error - 3:10:20 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:10:20 AM] Connection to server got closed. Server will restart.
true
[Error - 3:10:20 AM] oxc client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[2024-05-09T22:10:20Z INFO oxc_language_server] initialize: Options { run: OnSave, enable: true, config_path: "eslint.config.js" }
[2024-05-09T22:10:20Z INFO oxc_language_server] language server version: "0.0.1"
thread 'main' panicked at crates/oxc_language_server/src/main.rs:351:18:
should have initialized linter with new options: x Failed to parse jsonc file "/Users/dalisoft/Desktop/ignore_folder/
| test/test-backend/eslint.config.js"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error - 3:10:20 AM] Server process exited with signal SIGABRT.
[Error - 3:10:20 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:10:20 AM] Connection to server got closed. Server will restart.
true
[Error - 3:10:20 AM] oxc client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[2024-05-09T22:10:20Z INFO oxc_language_server] initialize: Options { run: OnSave, enable: true, config_path: "eslint.config.js" }
[2024-05-09T22:10:20Z INFO oxc_language_server] language server version: "0.0.1"
thread 'main' panicked at crates/oxc_language_server/src/main.rs:351:18:
should have initialized linter with new options: x Failed to parse jsonc file "/Users/dalisoft/Desktop/ignore_folder/
| test/test-backend/eslint.config.js"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error - 3:10:20 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:10:20 AM] Connection to server got closed. Server will restart.
true
[Error - 3:10:20 AM] oxc client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:10:20 AM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:10:20 AM] Server process exited with signal SIGABRT.
[2024-05-09T22:10:20Z INFO oxc_language_server] initialize: Options { run: OnSave, enable: true, config_path: "eslint.config.js" }
[2024-05-09T22:10:20Z INFO oxc_language_server] language server version: "0.0.1"
thread 'main' panicked at crates/oxc_language_server/src/main.rs:351:18:
should have initialized linter with new options: x Failed to parse jsonc file "/Users/dalisoft/Desktop/ignore_folder/
| test/test-backend/eslint.config.js"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error - 3:10:20 AM] Server process exited with signal SIGABRT.
[Error - 3:10:20 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:10:20 AM] Connection to server got closed. Server will restart.
true
[Error - 3:10:20 AM] oxc client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:10:20 AM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
[2024-05-09T22:10:20Z INFO oxc_language_server] initialize: Options { run: OnSave, enable: true, config_path: "eslint.config.js" }
[2024-05-09T22:10:20Z INFO oxc_language_server] language server version: "0.0.1"
thread 'main' panicked at crates/oxc_language_server/src/main.rs:351:18:
should have initialized linter with new options: x Failed to parse jsonc file "/Users/dalisoft/Desktop/ignore_folder/
| test/test-backend/eslint.config.js"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error - 3:10:20 AM] Server process exited with signal SIGABRT.
[Error - 3:10:20 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:10:20 AM] The oxc server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 3:10:20 AM] oxc client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:10:20 AM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
currently only works with an .eslintrc.json
file, oxlint doens't parse or resolve anything else. I think this is why it would be better to create an oxlint.config.json
file for configuration to be less confusing. That way we can use that config in the eslint plugin with a clearer abstraction.
then we could add a configure
method config in eslint-plugin-oxlint
f.ex:
export default {
configs: {
configure: (oxlintConfig: RuleConfigurations) => {
const filteredConfig: RuleConfigurations = {};
for (const key of Object.keys(oxlintConfig)) {
if (Object.prototype.hasOwnProperty.call(allRules, key)) {
filteredConfig[key] = oxlintConfig[key] as RuleSetting;
} else {
console.warn(
`eslint-plugin-oxlint: Rule ${key} is not implemented in oxlint.`
);
}
}
return {
name: 'oxlint',
rules: filteredConfig,
};
},
recommended: {
plugins: ['oxlint'],
rules: ruleMapsByCategory.correctnessRules,
},
...
}
what do you think @Boshen ?
The VS Code extension does not show any errors that
oxlint
finds when running it from the terminal.In fact, what is the extension actually supposed to do? How do I know it is working?