From dd4286a20f585a12535f321d02d2435fc27eb9b5 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Mon, 8 Apr 2024 14:29:43 +0200 Subject: [PATCH 1/2] feat(eslint-plugin): add triple-slash-reference rule to ban TS '///' within source code --- ...eslint-plugin-ee7a918a-238e-45f3-8a6b-18eb7ca7e02b.json | 7 +++++++ packages/cra-template/.eslintrc.json | 4 +++- packages/eslint-plugin/src/configs/base.js | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 change/@fluentui-eslint-plugin-ee7a918a-238e-45f3-8a6b-18eb7ca7e02b.json diff --git a/change/@fluentui-eslint-plugin-ee7a918a-238e-45f3-8a6b-18eb7ca7e02b.json b/change/@fluentui-eslint-plugin-ee7a918a-238e-45f3-8a6b-18eb7ca7e02b.json new file mode 100644 index 00000000000000..7733b053773023 --- /dev/null +++ b/change/@fluentui-eslint-plugin-ee7a918a-238e-45f3-8a6b-18eb7ca7e02b.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "feat(eslint-plugin): add triple-slash-reference rule to ban TS '///' within source code", + "packageName": "@fluentui/eslint-plugin", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/cra-template/.eslintrc.json b/packages/cra-template/.eslintrc.json index efb1ca6d6e8af1..d3285bf6e52a6c 100644 --- a/packages/cra-template/.eslintrc.json +++ b/packages/cra-template/.eslintrc.json @@ -6,7 +6,9 @@ "files": ["template/**/*.{ts,tsx}"], "rules": { // the rule can't understand that the actual list of deps is in template.json - "import/no-extraneous-dependencies": "off" + "import/no-extraneous-dependencies": "off", + // valid in some template files - don't wanna spam consumer with inline eslint-disabled pragmas + "@typescript-eslint/triple-slash-reference": "off" } } ] diff --git a/packages/eslint-plugin/src/configs/base.js b/packages/eslint-plugin/src/configs/base.js index 5956169dcabe74..2423f8a7b8b882 100644 --- a/packages/eslint-plugin/src/configs/base.js +++ b/packages/eslint-plugin/src/configs/base.js @@ -14,6 +14,8 @@ module.exports = { */ ...getNamingConventionRule(), '@fluentui/max-len': 'off', + // @typescript-eslint rules + '@typescript-eslint/triple-slash-reference': ['error', { lib: 'always', path: 'never', types: 'never' }], }, overrides: [ { From f99689794de7c4ebf77c3122ef9885dc36e7cf7d Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 11 Apr 2024 13:32:00 +0200 Subject: [PATCH 2/2] style(react-tag-picker-preview): fix lint violations --- .../src/components/TagPicker/TagPicker.cy.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-components/react-tag-picker-preview/src/components/TagPicker/TagPicker.cy.tsx b/packages/react-components/react-tag-picker-preview/src/components/TagPicker/TagPicker.cy.tsx index 5ae35607e2e9bf..ebb4365addd300 100644 --- a/packages/react-components/react-tag-picker-preview/src/components/TagPicker/TagPicker.cy.tsx +++ b/packages/react-components/react-tag-picker-preview/src/components/TagPicker/TagPicker.cy.tsx @@ -1,6 +1,3 @@ -/// -/// - import * as React from 'react'; import { mount as mountBase } from '@cypress/react'; import { FluentProvider } from '@fluentui/react-provider';