Skip to content

Align config basePath with ESLint flat config #1201

Description

@chenjiahan

Summary

Rslint should consider supporting the ESLint flat config basePath option on config entries.

In ESLint, basePath sets a subdirectory base for a config object. Relative basePath values are resolved from the config file directory, or from cwd when using an alternate config via --config; files and ignores in that object are then resolved relative to that base path.

Why

Rslint recently aligned explicit --config handling with ESLint by resolving files, ignores, and parserOptions.project from cwd. Supporting basePath would close the next compatibility gap for users sharing or migrating ESLint flat configs.

Without support, configs like this are silently interpreted with the wrong match base:

export default [
  {
    basePath: 'packages/foo',
    files: ['src/**/*.ts'],
    ignores: ['fixtures/**'],
  },
];

Suggested behavior

  • Add basePath?: string to config entries.
  • Resolve relative basePath from the config directory for auto-discovered configs.
  • Resolve relative basePath from cwd for explicit --config configs.
  • Resolve that entry's files, ignores, and languageOptions.parserOptions.project relative to the effective base path.
  • Treat { basePath, ignores } as a global ignore entry, matching ESLint's intent for scoped global ignores.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions