Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore(eslint-plugin): register @nx plugin internally in order to be able to consume our custom @nx/workspace-* lint rules",
"packageName": "@fluentui/eslint-plugin",
"email": "martinhochel@microsoft.com",
"dependentChangeType": "none"
}
12 changes: 11 additions & 1 deletion packages/eslint-plugin/src/configs/core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
const { __internal } = require('../internal');
const configHelpers = require('../utils/configHelpers');

/** @type {import("eslint").Linter.Config} */
Expand All @@ -13,7 +14,16 @@ const config = {
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: ['import', '@fluentui', '@rnx-kit', '@typescript-eslint', 'deprecation', 'jest', 'jsdoc'],
plugins: [
'import',
'@fluentui',
'@rnx-kit',
'@typescript-eslint',
'deprecation',
'jest',
'jsdoc',
...__internal.plugins,
],
settings: {
'import/resolver': {
// @see https://github.com/alexgorbatchev/eslint-import-resolver-typescript#configuration
Expand Down
26 changes: 26 additions & 0 deletions packages/eslint-plugin/src/internal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function shouldRegisterInternal() {
try {
const hasNxEslintPlugin = require.resolve('@nx/eslint-plugin');
return Boolean(hasNxEslintPlugin);
} catch (err) {
return false;
}
}

const shouldRegister = shouldRegisterInternal();

/**
* @internal
*
* this will be removed after https://github.com/microsoft/fluentui/issues/30332
*
* expands this with rulesets/overrides that are necessary for specific configs
*/
const __internal = {
Comment thread
Hotell marked this conversation as resolved.
/**
* `@nx/eslint-plugin` is necessary in order to register custom lint rules that live within tools/eslint-rules
*/
plugins: shouldRegister ? ['@nx'] : [],
};

exports.__internal = __internal;