Skip to content

[Feature]: add internal workspace eslint-rules #30332

@Hotell

Description

@Hotell

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

ATM any custom eslint rule goes to public @fluentui/eslint-plugin.

This has various issues:

  • exposing publicly eslint rules that might be only for internal stuff
  • adding technical depth to already very complex configuration within the existing plugin
  • authoring rules in vanilla js / no type guarantees within tests

All of these can be mitigated with monorepo internal set of lint rules.

Implementation of internal rules:

new project bootstrapped -> tools/eslint-rules, under the hood this uses nx workspace lint rule resolution.

Registration of internal rules:

As a contrived example let say we implement custom lint rule named uppercase-const

This is how on ca use it in particular project:

{
 "rules": {
     "@nx/workspace-uppercase-const": "error"
  }
}

Additional Context

In order to make this work we need @nx/eslint-plugin registered within our monorepo eslint root config which will load these custom rules under the hood.

To make that work we need overhaul of eslint configs within our projects to extend from monorepo root eslint config

{
-  "extends": ["plugin:@fluentui/eslint-plugin/react"],
+  "extends": ["../../../.eslintrc", "plugin:@fluentui/eslint-plugin/react"],
-  "root": true,
    "rules": {
      "@nx/workspace-uppercase-const": "warn"
     }
}

Tasks:

Have you discussed this feature with our team

v-build

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Priority

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions