tools/eslint-rules/README.md
Set of internal workspace eslint rules.
NOTE:
Under the hood this leverages nx workspace lint rule registration which happens within
@nx/eslint-pluginregistration. With that said to be able to use these rules@nxeslint plugin needs to be registered within our eslint config chain ( plugins setup )
Let's say we implement custom lint rule named uppercase-const.
Following rule declaration will enable it for particular lint config:
// @filename <project-root>/eslint.config.js
// @ts-check
const fluentPlugin = require('@fluentui/eslint-plugin');
/** @type {import("eslint").Linter.Config[]} */
module.exports = [
// or 'flat/react-legacy', 'flat/node', etc.
...fluentPlugin.configs['flat/core'],
{
rules: {
// pattern: <@nx/workspace>-<custom-rule-name>
'@nx/workspace-uppercase-const': 'error',
},
},
];
npx nx g @fluentui/workspace-plugin:eslint-rule