Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ impl CliRunner {
let config_store = ConfigStore::new(lint_config, nested_configs, external_plugin_store);
let type_aware = self.options.type_aware || config_store.type_aware_enabled();
let type_check = self.options.type_check || config_store.type_check_enabled();
if type_check && !type_aware {
print_and_flush_stdout(
stdout,
"The `--type-check` option requires type-aware linting.\nUse `--type-aware --type-check` or enable `options.typeAware` in your config.\n",
);
return CliRunResult::InvalidOptionTypeCheckWithoutTypeAware;
}
let deny_warnings = warning_options.deny_warnings || config_store.deny_warnings();
let max_warnings = warning_options.max_warnings.or(config_store.max_warnings());

Expand Down Expand Up @@ -1332,6 +1339,13 @@ mod test {
Tester::new().with_cwd("fixtures/tsgolint_type_error".into()).test_and_snapshot(args);
}

#[test]
#[cfg(not(target_endian = "big"))]
fn test_tsgolint_type_check_requires_type_aware() {
let args = &["--type-check"];
Tester::new().with_cwd("fixtures/tsgolint_type_error".into()).test_and_snapshot(args);
}

#[test]
#[cfg(not(target_endian = "big"))]
fn test_tsgolint_type_check_via_config_file() {
Expand Down
2 changes: 2 additions & 0 deletions apps/oxlint/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub enum CliRunResult {
JsPluginWorkspaceSetupFailed,
InvalidOptionConfig,
InvalidOptionTsConfig,
InvalidOptionTypeCheckWithoutTypeAware,
InvalidOptionSeverityWithoutFilter,
InvalidOptionSeverityWithoutPluginName,
InvalidOptionSeverityWithoutRuleName,
Expand Down Expand Up @@ -36,6 +37,7 @@ impl Termination for CliRunResult {
| Self::LintMaxWarningsExceeded
| Self::InvalidOptionConfig
| Self::InvalidOptionTsConfig
| Self::InvalidOptionTypeCheckWithoutTypeAware
| Self::InvalidOptionSeverityWithoutFilter
| Self::InvalidOptionSeverityWithoutPluginName
| Self::InvalidOptionSeverityWithoutRuleName
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source: apps/oxlint/src/tester.rs
---
##########
arguments: --type-check
working directory: fixtures/tsgolint_type_error
----------
The `--type-check` option requires type-aware linting.
Use `--type-aware --type-check` or enable `options.typeAware` in your config.
----------
CLI result: InvalidOptionTypeCheckWithoutTypeAware
----------
Loading