Skip to content

Lint folder/file name casing #704

Open
@MaoShizhong

Description

@MaoShizhong

Checks

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this issue follows the command name: brief description of request format, e.g. /help: add optional @user parameter

Do you want to be assigned to this issue?

  • I would like to be assigned this issue to work on it

Description of the Feature Request

Just as the current ESLint config enforces casing for stuff in JS, it would be nice to enforce casing in folder and file names. Kebab case seems to be the most common convention in this repo, but some folders/files use snake case or camel case.

I've had a look at some ESLint plugins and most have caveats like only scanning JS/TS files or folders that contain JS/TS files, or compatibility issues with ESLint v8 or v9 etc. (sigh)

eslint-plugin-check-file is the closest I could find that handles both files and folders together, but v2.8 is the latest version that can be used while we're still using ESLint v8 and eslintrc (blocked by airbnb-base support for ESLint v9).

Caveat: v2.8 can only lint JS/TS files, and folders containing them. It does not lint non-JS files or folders that only contain non-JS files. So most but not all of our files can be linted for name casing.

Future uncaveat: It can do so in v3, so when airbnb-base supports flatconfig/ESLint v9 and this codebase migrates to that, this plugin can be upgraded and lint everything.

Acceptance Criteria

This issue can be closed/blocked to be revisited if and when the codebase can be migrated to ESLint v9 and flat config.

But if the team think it's sensible to add partial name case linting with v2.8 of the plugin for now, then update if and when the rest of ESLint can be updated:

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs ReviewThis issue/PR needs an initial or additional review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions