oxc-project/oxc · error · OxcDiagnostic

Filename should be in {cases}

Error message

Filename should be in {cases}

What it means

Raised by unicorn/filename-case when a file's name does not match the configured casing convention (e.g. camelCase, kebab-case, pascalCase, snakeCase). Enforces consistent file naming across the project.

Source

Thrown at crates/oxc_linter/src/rules/unicorn/filename_case.rs:18

use convert_case::{Boundary, Case, Converter};
use cow_utils::CowUtils;
use lazy_regex::Regex;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    context::{ContextHost, LintContext},
    rule::{DefaultRuleConfig, Rule},
    utils::{default_true, deserialize_regex_vec},
};

fn filename_case_diagnostic(message: String, help_message: String) -> OxcDiagnostic {
    OxcDiagnostic::warn(message).with_label(Span::default()).with_help(help_message)
}

#[derive(Debug, Clone, Default)]
pub struct FilenameCase(Box<FilenameCaseConfig>);

impl std::ops::Deref for FilenameCase {
    type Target = FilenameCaseConfig;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

#[derive(Debug, Clone)]
pub struct FilenameCaseConfig {
    kebab_case: bool,
    camel_case: bool,
    snake_case: bool,

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Rename the file to the configured case (the help message shows the exact suggestion).
  2. Adjust the rule's cases option to allow the current convention.
  3. Add the file to the rule's ignore list if the name is fixed by convention (e.g. LICENSE).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/unicorn/filename_case.rs:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/e5bb1e4c2058af73. Report an issue: GitHub.