diff --git a/azure/packages/azure-local-service/eslint.config.mts b/azure/packages/azure-local-service/eslint.config.mts index d14fd54d9ab9..863f297b7ac3 100644 --- a/azure/packages/azure-local-service/eslint.config.mts +++ b/azure/packages/azure-local-service/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.eslint.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/azure/packages/azure-service-utils/eslint.config.mts b/azure/packages/azure-service-utils/eslint.config.mts index 73e56c75b50d..c0269cce1d85 100644 --- a/azure/packages/azure-service-utils/eslint.config.mts +++ b/azure/packages/azure-service-utils/eslint.config.mts @@ -3,33 +3,36 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-unassigned-import": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "import-x/no-unassigned-import": "off", + "@typescript-eslint/strict-boolean-expressions": "off", - // Useful for developer accessibility - "unicorn/prevent-abbreviations": [ - "error", - { - allowList: { - // Industry-standard index variable name. - i: true, + // Useful for developer accessibility + "unicorn/prevent-abbreviations": [ + "error", + { + allowList: { + // Industry-standard index variable name. + i: true, + }, }, - }, - ], + ], + }, }, - overrides: [ - { - // Overrides for type-tests - files: ["src/test/types/*"], - rules: { - "unicorn/prevent-abbreviations": "off", - }, + + // Overrides for type-tests + { + files: ["src/test/types/*"], + rules: { + "unicorn/prevent-abbreviations": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/build-tools/packages/build-cli/eslint.config.mts b/build-tools/packages/build-cli/eslint.config.mts index a7ebba4c7108..a1829c361737 100644 --- a/build-tools/packages/build-cli/eslint.config.mts +++ b/build-tools/packages/build-cli/eslint.config.mts @@ -3,120 +3,30 @@ * Licensed under the MIT License. */ -module.exports = { - plugins: ["@typescript-eslint"], - extends: [ - "oclif", - "oclif-typescript", - // eslint-disable-next-line node/no-extraneous-require - require.resolve("@fluidframework/eslint-config-fluid/recommended"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: Enable and fix violations - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - - // Catch unused variables in at lint time instead of compile time - "@typescript-eslint/no-unused-vars": "error", - - // This rule is often triggered when using custom Flags, so disabling. - "object-shorthand": "off", - - // This package is exclusively used in a Node.js context - "import-x/no-nodejs-modules": "off", - - // oclif uses default exports for commands - "import-x/no-default-export": "off", - - // Set to warn because we're not ready to enforce this rule for much of build-cli yet. It is enabled for new code. - "import-x/no-deprecated": "warn", - - "import-x/no-internal-modules": [ - "error", - { - allow: [ - // fs-extra's ./esm export is needed for ESM support. - "fs-extra/esm", - - // This package uses interfaces and types that are not exposed directly by npm-check-updates. - "npm-check-updates/build/src/types/**", - - // We call oclif commands' run method directly in some cases, so these are all excluded. - "**/commands/**", +import { baseConfig } from "../../eslint.config.base.mts"; - // These are all excluded because they're "submodules" used for organization. - // AB#8118 tracks removing the barrel files and importing directly from the submodules. - "**/library/**", - "**/handlers/**", - "**/machines/**", - "**/repoPolicyCheck/**", - "**/azureDevops/**", - "**/codeCoverage/**", - "azure-devops-node-api/**", - ], - }, - ], - - // Superseded by Biome - "import/order": "off", - - "jsdoc/multiline-blocks": [ - "error", - { - noSingleLineBlocks: true, - }, - ], - - // The default for this rule is 4, but 5 is better - "max-params": ["warn", 5], - - // Too strict for our needs - "unicorn/filename-case": "off", - - // In commands, destructuring is useful in some places but makes others less legible, so consistency isn't preferred. - "unicorn/consistent-destructuring": "off", - - // Deprecated in 2018: https://eslint.org/blog/2018/11/jsdoc-end-of-life/ - "valid-jsdoc": "off", - - // Disable all perfectionist rules that are inherited from oclif's lint config. - "perfectionist/sort-array-includes": "off", - "perfectionist/sort-astro-attributes": "off", - "perfectionist/sort-classes": "off", - "perfectionist/sort-enums": "off", - "perfectionist/sort-exports": "off", - "perfectionist/sort-imports": "off", - "perfectionist/sort-interfaces": "off", - "perfectionist/sort-intersection-types": "off", - "perfectionist/sort-jsx-props": "off", - "perfectionist/sort-maps": "off", - "perfectionist/sort-named-exports": "off", - "perfectionist/sort-named-imports": "off", - "perfectionist/sort-object-types": "off", - "perfectionist/sort-objects": "off", - "perfectionist/sort-svelte-attributes": "off", - "perfectionist/sort-union-types": "off", - "perfectionist/sort-vue-attributes": "off", +export default [ + ...baseConfig, + // Ignore test data files and test fixtures that aren't in tsconfig + { + ignores: ["src/test/data/**", "src/test/**/fixtures/**"], }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files can import from anywhere - "import-x/no-internal-modules": "off", - }, + { + rules: { + // This rule is often triggered when using custom Flags, so disabling. + "object-shorthand": "off", + + // The default for this rule is 4, but 5 is better. + // TODO: AB#58055 Consider lowering this limit and simplifying build-tools code accordingly. + "max-params": ["warn", 5], }, - { - // Rules only for files that are built on the build-infrastructure APIs. - files: ["src/**/vnext/**"], - rules: { - // Set to error since code using build-infrastructure APIs should not need to use any deprecated APIs. - "import-x/no-deprecated": "error", - }, + }, + { + // Rules only for files that are built on the build-infrastructure APIs. + files: ["src/**/vnext/**"], + rules: { + // Set to error since code using build-infrastructure APIs should not need to use any deprecated APIs. + "import-x/no-deprecated": "error", }, - ], -}; + }, +]; diff --git a/build-tools/packages/build-infrastructure/eslint.config.mts b/build-tools/packages/build-infrastructure/eslint.config.mts index e8911fafa541..22ee2b0af59e 100644 --- a/build-tools/packages/build-infrastructure/eslint.config.mts +++ b/build-tools/packages/build-infrastructure/eslint.config.mts @@ -3,39 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - plugins: ["@typescript-eslint", "chai-friendly"], - extends: [ - // eslint-disable-next-line node/no-extraneous-require - require.resolve("@fluidframework/eslint-config-fluid/recommended"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // Catch unused variables in at lint time instead of compile time - "@typescript-eslint/no-unused-vars": "error", - - // This package is exclusively used in a Node.js context - "import-x/no-nodejs-modules": "off", +import { baseConfig, chaiFriendlyConfig } from "../../eslint.config.base.mts"; - "tsdoc/syntax": ["warn"], +export default [ + ...baseConfig, + // Ignore test data files + { + ignores: ["src/test/data/**"], }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files can import from anywhere - "import-x/no-internal-modules": "off", - - // Superseded by chai-friendly/no-unused-expressions - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": "off", - - "chai-friendly/no-unused-expressions": "error", - }, - }, - ], -}; + // Chai-friendly rules for test files + { + files: ["**/*.spec.ts", "src/test/**"], + ...chaiFriendlyConfig, + }, +]; diff --git a/build-tools/packages/build-tools/eslint.config.mts b/build-tools/packages/build-tools/eslint.config.mts index 68c26df949f8..99ffa51b53a3 100644 --- a/build-tools/packages/build-tools/eslint.config.mts +++ b/build-tools/packages/build-tools/eslint.config.mts @@ -3,26 +3,70 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], - plugins: ["@typescript-eslint"], - parser: "@typescript-eslint/parser", - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], +import { baseConfig } from "../../eslint.config.base.mts"; + +export default [ + ...baseConfig, + // Ignore test data files + { + ignores: ["src/test/data/**"], }, - rules: { - // TODO: Enable these ASAP - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", + { + rules: { + // build-tools uses some template-like tokens for use in configs + "no-template-curly-in-string": "off", + + // TODO: AB#58049 Enable these type-safety rules ASAP and fix violations + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + + "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/no-non-null-assertion": "error", + // Allow empty object types for extending interfaces + "@typescript-eslint/no-empty-object-type": "off", - // Catch unused variables in at lint time instead of compile time - "@typescript-eslint/no-unused-vars": "error", + // Allow require imports for dynamic loading + "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/switch-exhaustiveness-check": "error", + // TODO: AB#58050 These rules require code changes - enable and fix violations + "@typescript-eslint/class-literal-property-style": "off", + "@typescript-eslint/return-await": "off", + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/no-restricted-imports": "off", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/await-thenable": "off", + "@typescript-eslint/prefer-string-starts-ends-with": "off", + "@typescript-eslint/prefer-includes": "off", + "@typescript-eslint/no-dynamic-delete": "off", + "@typescript-eslint/prefer-for-of": "off", + "@typescript-eslint/only-throw-error": "off", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/no-extraneous-class": "off", + "unicorn/prefer-ternary": "off", + "unicorn/better-regex": "off", + "jsdoc/check-indentation": "off", + "@eslint-community/eslint-comments/no-unused-disable": "off", + "@eslint-community/eslint-comments/no-unlimited-disable": "off", + + // TODO: AB#58051 Base ESLint rules that require code changes - enable and fix violations + "guard-for-in": "off", + "no-restricted-syntax": "off", + "eqeqeq": "off", + "no-param-reassign": "off", + "no-undef-init": "off", + "default-case": "off", + "radix": "off", + }, + }, + // Enable switch-exhaustiveness-check only for TS files (not .d.ts which lack type info) + { + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + ignores: ["**/*.d.ts"], + rules: { + "@typescript-eslint/switch-exhaustiveness-check": "error", + }, }, -}; +]; diff --git a/build-tools/packages/bundle-size-tools/eslint.config.mts b/build-tools/packages/bundle-size-tools/eslint.config.mts index 9c8c0c4df44e..c155d2f962ca 100644 --- a/build-tools/packages/bundle-size-tools/eslint.config.mts +++ b/build-tools/packages/bundle-size-tools/eslint.config.mts @@ -3,19 +3,6 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - plugins: ["@typescript-eslint"], - parser: "@typescript-eslint/parser", - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - "@typescript-eslint/switch-exhaustiveness-check": "error", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-var-requires": "off", +import { baseConfig } from "../../eslint.config.base.mts"; - // This package is exclusively used in a Node.js context - "import/no-nodejs-modules": "off", - }, -}; +export default baseConfig; diff --git a/build-tools/packages/version-tools/eslint.config.mts b/build-tools/packages/version-tools/eslint.config.mts index 7f21ef81c563..c155d2f962ca 100644 --- a/build-tools/packages/version-tools/eslint.config.mts +++ b/build-tools/packages/version-tools/eslint.config.mts @@ -3,24 +3,6 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // We use semver classes a lot in this package, and they stringify without issue but this rule is still triggered, - // so disabling. - "@typescript-eslint/no-base-to-string": "off", +import { baseConfig } from "../../eslint.config.base.mts"; - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // This package is exclusively used in a Node.js context - "import-x/no-nodejs-modules": "off", - - "import-x/no-default-export": "off", - "import-x/no-deprecated": "off", - "import-x/no-named-as-default-member": "off", - }, -}; +export default baseConfig; diff --git a/common/lib/common-utils/eslint.config.mts b/common/lib/common-utils/eslint.config.mts index 662736648041..28a94229db4a 100644 --- a/common/lib/common-utils/eslint.config.mts +++ b/common/lib/common-utils/eslint.config.mts @@ -3,43 +3,91 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: [ - "./tsconfig.json", - "./src/test/mocha/tsconfig.json", - "./src/test/jest/tsconfig.json", - "./src/test/types/tsconfig.json", - ], - }, - rules: { - // This package is being deprecated, so it's okay to use deprecated APIs. - "import/no-deprecated": "off", +// TODO: AB#59243 Replace this standalone config with @fluidframework/eslint-config-fluid once a +// version is published that supports ESLint 9 flat config. - // This package uses node's events APIs. - // This should probably be reconsidered, but until then we will leave an exception for it here. - "import/no-nodejs-modules": ["error", { allow: ["events"] }], +import eslint from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import rushstackPlugin from "@rushstack/eslint-plugin"; +import importPlugin from "eslint-plugin-import"; +import unicornPlugin from "eslint-plugin-unicorn"; +import tseslint from "typescript-eslint"; - // This package has been deprecated. The following rules have a significant number of violations - // that will not be fixed here. - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "unicorn/text-encoding-identifier-case": "off", - "unicorn/prefer-node-protocol": "off", - "unicorn/prefer-code-point": "off", +export default tseslint.config( + { + ignores: ["dist/**", "lib/**", "node_modules/**", "**/*.d.ts"], }, - overrides: [ - { - files: ["src/test/**/*"], - rules: { - // It's fine for tests to use node.js modules. - "import/no-nodejs-modules": "off", + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + eslintConfigPrettier, + { + plugins: { + "@rushstack": rushstackPlugin, + "import": importPlugin, + "unicorn": unicornPlugin, + }, + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, }, }, - ], -}; + rules: { + // Rules from the shared config that are referenced by inline eslint-disable comments. + "@rushstack/no-new-null": "error", + "@typescript-eslint/no-non-null-assertion": "error", + "default-case": "error", + "import/no-internal-modules": "error", + "no-bitwise": "error", + "no-new-func": "error", + "no-restricted-syntax": [ + "error", + { + selector: "ExportAllDeclaration", + message: + "Exporting * is not permitted. You should export only named items you intend to export.", + }, + ], + "unicorn/error-message": "error", + "unicorn/no-thenable": "error", + + // This package is being deprecated, so it's okay to use deprecated APIs. + "@typescript-eslint/no-deprecated": "off", + "import/no-deprecated": "off", + + // This package uses node's events APIs. + // This should probably be reconsidered, but until then we will leave an exception for it here. + "import/no-nodejs-modules": ["error", { allow: ["events"] }], + + // This package has been deprecated. The following rules have a significant number of + // violations that will not be fixed here. + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/require-await": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/prefer-promise-reject-errors": "off", + "@typescript-eslint/no-duplicate-type-constituents": "off", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/no-redundant-type-constituents": "off", + "@typescript-eslint/prefer-nullish-coalescing": "off", + "unicorn/text-encoding-identifier-case": "off", + "unicorn/prefer-node-protocol": "off", + "unicorn/prefer-code-point": "off", + }, + }, + { + files: ["src/test/**"], + rules: { + // It's fine for tests to use node.js modules. + "import/no-nodejs-modules": "off", + }, + }, +); diff --git a/common/lib/protocol-definitions/eslint.config.mts b/common/lib/protocol-definitions/eslint.config.mts index eb13ebe130a6..26fdf796242d 100644 --- a/common/lib/protocol-definitions/eslint.config.mts +++ b/common/lib/protocol-definitions/eslint.config.mts @@ -3,7 +3,44 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - rules: {}, -}; +// TODO: AB#59243 Replace this standalone config with @fluidframework/eslint-config-fluid once a +// version is published that supports ESLint 9 flat config. + +import eslint from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import rushstackPlugin from "@rushstack/eslint-plugin"; +import unicornPlugin from "eslint-plugin-unicorn"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + { + ignores: ["dist/**", "lib/**", "node_modules/**", "**/*.d.ts"], + }, + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + eslintConfigPrettier, + { + plugins: { + "@rushstack": rushstackPlugin, + "unicorn": unicornPlugin, + }, + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + "@rushstack/no-new-null": "error", + "unicorn/text-encoding-identifier-case": "error", + }, + }, + { + files: ["src/test/**"], + rules: { + // Generated type validation files use many unused variables by design. + "@typescript-eslint/no-unused-vars": "off", + }, + }, +); diff --git a/examples/apps/blobs/eslint.config.mts b/examples/apps/blobs/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/apps/blobs/eslint.config.mts +++ b/examples/apps/blobs/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/apps/collaborative-textarea/eslint.config.mts b/examples/apps/collaborative-textarea/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/apps/collaborative-textarea/eslint.config.mts +++ b/examples/apps/collaborative-textarea/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/apps/contact-collection/eslint.config.mts b/examples/apps/contact-collection/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/apps/contact-collection/eslint.config.mts +++ b/examples/apps/contact-collection/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/apps/data-object-grid/eslint.config.mts b/examples/apps/data-object-grid/eslint.config.mts index 2c8c91ccf6ce..a0d64c183ad3 100644 --- a/examples/apps/data-object-grid/eslint.config.mts +++ b/examples/apps/data-object-grid/eslint.config.mts @@ -3,15 +3,20 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", // Doing undefined checks is nice - "@typescript-eslint/unbound-method": "off", // Used to do binding for react methods - "import-x/no-unassigned-import": "off", // required for dynamically importing css files for react-grid-layout +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", // Doing undefined checks is nice + "@typescript-eslint/unbound-method": "off", // Used to do binding for react methods + "import-x/no-unassigned-import": "off", // required for dynamically importing css files for react-grid-layout + }, }, -}; +]; + +export default config; diff --git a/examples/apps/diceroller/eslint.config.mts b/examples/apps/diceroller/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/apps/diceroller/eslint.config.mts +++ b/examples/apps/diceroller/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/apps/presence-tracker/eslint.config.mts b/examples/apps/presence-tracker/eslint.config.mts index 74ee69d03b3a..0b10f2653e8c 100644 --- a/examples/apps/presence-tracker/eslint.config.mts +++ b/examples/apps/presence-tracker/eslint.config.mts @@ -3,14 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/apps/staging/eslint.config.mts b/examples/apps/staging/eslint.config.mts index 35b70a28a67b..a2e69a55d292 100644 --- a/examples/apps/staging/eslint.config.mts +++ b/examples/apps/staging/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/apps/task-selection/eslint.config.mts b/examples/apps/task-selection/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/apps/task-selection/eslint.config.mts +++ b/examples/apps/task-selection/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/apps/tree-cli-app/eslint.config.mts b/examples/apps/tree-cli-app/eslint.config.mts index 42e9cdc4ba99..786003032827 100644 --- a/examples/apps/tree-cli-app/eslint.config.mts +++ b/examples/apps/tree-cli-app/eslint.config.mts @@ -3,13 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/strict"), - "prettier", - "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...strict, ...sharedConfig]; + +export default config; diff --git a/examples/apps/tree-comparison/eslint.config.mts b/examples/apps/tree-comparison/eslint.config.mts index 35b70a28a67b..a2e69a55d292 100644 --- a/examples/apps/tree-comparison/eslint.config.mts +++ b/examples/apps/tree-comparison/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/benchmarks/bubblebench/baseline/eslint.config.mts b/examples/benchmarks/bubblebench/baseline/eslint.config.mts index 5a7737fca277..bde6b9d545ec 100644 --- a/examples/benchmarks/bubblebench/baseline/eslint.config.mts +++ b/examples/benchmarks/bubblebench/baseline/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/benchmarks/bubblebench/common/eslint.config.mts b/examples/benchmarks/bubblebench/common/eslint.config.mts index e9b3e904d78b..a1c73a3d5d3f 100644 --- a/examples/benchmarks/bubblebench/common/eslint.config.mts +++ b/examples/benchmarks/bubblebench/common/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/benchmarks/bubblebench/experimental-tree/eslint.config.mts b/examples/benchmarks/bubblebench/experimental-tree/eslint.config.mts index 108f3eb4e788..a3c03775c1c7 100644 --- a/examples/benchmarks/bubblebench/experimental-tree/eslint.config.mts +++ b/examples/benchmarks/bubblebench/experimental-tree/eslint.config.mts @@ -3,22 +3,31 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; - // Causes eslint to stack-overflow. Given that this is testing a DDS we are no longer actively developing, - // we can probably just ignore this until this package is eventually removed. - "@typescript-eslint/no-unsafe-argument": "off", +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + // Causes eslint to stack-overflow. Given that this is testing a DDS we are no longer actively developing, + // we can probably just ignore this until this package is eventually removed. + "@typescript-eslint/no-unsafe-argument": "off", - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", + // TODO: fix violations and remove this override + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, + }, +]; + +export default config; diff --git a/examples/benchmarks/bubblebench/ot/eslint.config.mts b/examples/benchmarks/bubblebench/ot/eslint.config.mts index 6b89755dfbf0..de9cd251525d 100644 --- a/examples/benchmarks/bubblebench/ot/eslint.config.mts +++ b/examples/benchmarks/bubblebench/ot/eslint.config.mts @@ -3,16 +3,26 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, + }, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/benchmarks/bubblebench/shared-tree/eslint.config.mts b/examples/benchmarks/bubblebench/shared-tree/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/benchmarks/bubblebench/shared-tree/eslint.config.mts +++ b/examples/benchmarks/bubblebench/shared-tree/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/benchmarks/odspsnapshotfetch-perftestapp/eslint.config.mts b/examples/benchmarks/odspsnapshotfetch-perftestapp/eslint.config.mts index a5e2d82bd14b..945c1f1a4014 100644 --- a/examples/benchmarks/odspsnapshotfetch-perftestapp/eslint.config.mts +++ b/examples/benchmarks/odspsnapshotfetch-perftestapp/eslint.config.mts @@ -3,10 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated")], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-extraneous-dependencies": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-extraneous-dependencies": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/benchmarks/tablebench/eslint.config.mts b/examples/benchmarks/tablebench/eslint.config.mts index e79ca9fb87b6..459b77d6348b 100644 --- a/examples/benchmarks/tablebench/eslint.config.mts +++ b/examples/benchmarks/tablebench/eslint.config.mts @@ -3,19 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/client-logger/app-insights-logger/eslint.config.mts b/examples/client-logger/app-insights-logger/eslint.config.mts index 7ab53fb2fc88..c13240a4ee22 100644 --- a/examples/client-logger/app-insights-logger/eslint.config.mts +++ b/examples/client-logger/app-insights-logger/eslint.config.mts @@ -3,18 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/recommended"), - "prettier", - "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/canvas/eslint.config.mts b/examples/data-objects/canvas/eslint.config.mts index 0ba67d333ec0..d03956d70237 100644 --- a/examples/data-objects/canvas/eslint.config.mts +++ b/examples/data-objects/canvas/eslint.config.mts @@ -3,16 +3,26 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig + }, + }, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/clicker/eslint.config.mts b/examples/data-objects/clicker/eslint.config.mts index bb31967df6fe..07749f43cd9f 100644 --- a/examples/data-objects/clicker/eslint.config.mts +++ b/examples/data-objects/clicker/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/codemirror/eslint.config.mts b/examples/data-objects/codemirror/eslint.config.mts index cde9fa544b41..e3c7225f42c4 100644 --- a/examples/data-objects/codemirror/eslint.config.mts +++ b/examples/data-objects/codemirror/eslint.config.mts @@ -3,14 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + ignores: ["*.spec.ts"], + }, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/inventory-app/eslint.config.mts b/examples/data-objects/inventory-app/eslint.config.mts index f24b9d7ea50b..1cabc0c286d3 100644 --- a/examples/data-objects/inventory-app/eslint.config.mts +++ b/examples/data-objects/inventory-app/eslint.config.mts @@ -3,35 +3,52 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - ], - plugins: ["react", "react-hooks"], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", - "react-hooks/exhaustive-deps": ["error"], - "react-hooks/rules-of-hooks": "error", - "react/jsx-key": [ - "error", - { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true, warnOnDuplicates: true }, - ], - "react/jsx-boolean-value": ["error", "always"], - "react/jsx-fragments": "error", - "react/no-string-refs": "error", - "react/no-unstable-nested-components": ["error", { allowAsProps: true }], - "react/self-closing-comp": "error", - "react/jsx-no-target-blank": "error", - // This is useful for catching potential performance issues, but also makes the code more verbose. - //"react/jsx-no-bind": "error", - // Avoid using fragments when `null` could be used instead - "react/jsx-no-useless-fragment": ["error", { allowExpressions: true }], - "react/prop-types": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + "react-hooks/exhaustive-deps": ["error"], + "react-hooks/rules-of-hooks": "error", + "react/jsx-key": [ + "error", + { + checkFragmentShorthand: true, + checkKeyMustBeforeSpread: true, + warnOnDuplicates: true, + }, + ], + "react/jsx-boolean-value": ["error", "always"], + "react/jsx-fragments": "error", + "react/no-string-refs": "error", + "react/no-unstable-nested-components": [ + "error", + { + allowAsProps: true, + }, + ], + "react/self-closing-comp": "error", + "react/jsx-no-target-blank": "error", + // This is useful for catching potential performance issues, but also makes the code more verbose. + // "react/jsx-no-bind": "error", + // Avoid using fragments when `null` could be used instead + "react/jsx-no-useless-fragment": [ + "error", + { + allowExpressions: true, + }, + ], + "react/prop-types": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/monaco/eslint.config.mts b/examples/data-objects/monaco/eslint.config.mts index 7f9e8d531cb6..7763e4be8d25 100644 --- a/examples/data-objects/monaco/eslint.config.mts +++ b/examples/data-objects/monaco/eslint.config.mts @@ -3,14 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "no-bitwise": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "no-bitwise": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/multiview/constellation-model/eslint.config.mts b/examples/data-objects/multiview/constellation-model/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/data-objects/multiview/constellation-model/eslint.config.mts +++ b/examples/data-objects/multiview/constellation-model/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/constellation-view/eslint.config.mts b/examples/data-objects/multiview/constellation-view/eslint.config.mts index f5a4f319110c..5ad6aa343379 100644 --- a/examples/data-objects/multiview/constellation-view/eslint.config.mts +++ b/examples/data-objects/multiview/constellation-view/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...minimalDeprecated, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/container/eslint.config.mts b/examples/data-objects/multiview/container/eslint.config.mts index 5a7737fca277..bde6b9d545ec 100644 --- a/examples/data-objects/multiview/container/eslint.config.mts +++ b/examples/data-objects/multiview/container/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/multiview/coordinate-model/eslint.config.mts b/examples/data-objects/multiview/coordinate-model/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/data-objects/multiview/coordinate-model/eslint.config.mts +++ b/examples/data-objects/multiview/coordinate-model/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/interface/eslint.config.mts b/examples/data-objects/multiview/interface/eslint.config.mts index f5a4f319110c..5ad6aa343379 100644 --- a/examples/data-objects/multiview/interface/eslint.config.mts +++ b/examples/data-objects/multiview/interface/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...minimalDeprecated, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/plot-coordinate-view/eslint.config.mts b/examples/data-objects/multiview/plot-coordinate-view/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/data-objects/multiview/plot-coordinate-view/eslint.config.mts +++ b/examples/data-objects/multiview/plot-coordinate-view/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/slider-coordinate-view/eslint.config.mts b/examples/data-objects/multiview/slider-coordinate-view/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/data-objects/multiview/slider-coordinate-view/eslint.config.mts +++ b/examples/data-objects/multiview/slider-coordinate-view/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/multiview/triangle-view/eslint.config.mts b/examples/data-objects/multiview/triangle-view/eslint.config.mts index 36335914adeb..51e4f98367ee 100644 --- a/examples/data-objects/multiview/triangle-view/eslint.config.mts +++ b/examples/data-objects/multiview/triangle-view/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/data-objects/prosemirror/eslint.config.mts b/examples/data-objects/prosemirror/eslint.config.mts index 28c27962f455..addb56dcd1c4 100644 --- a/examples/data-objects/prosemirror/eslint.config.mts +++ b/examples/data-objects/prosemirror/eslint.config.mts @@ -3,17 +3,25 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/restrict-plus-operands": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "no-case-declarations": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + ignores: ["*.spec.ts"], + }, + { + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "no-case-declarations": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/smde/eslint.config.mts b/examples/data-objects/smde/eslint.config.mts index fef276e653a1..8c7686078136 100644 --- a/examples/data-objects/smde/eslint.config.mts +++ b/examples/data-objects/smde/eslint.config.mts @@ -3,15 +3,28 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - // This is an example/test app; all its dependencies are dev dependencies so as not to pollute the lockfile - // with prod dependencies that aren't actually shipped. So don't complain when importing from dev dependencies. - "import-x/no-extraneous-dependencies": ["error", { devDependencies: true }], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + ignores: ["*.spec.ts"], + }, + { + rules: { + // This is an example/test app; all its dependencies are dev dependencies so as not to pollute the lockfile + // with prod dependencies that aren't actually shipped. So don't complain when importing from dev dependencies. + "import-x/no-extraneous-dependencies": [ + "error", + { + devDependencies: true, + }, + ], + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/table-document/eslint.config.mts b/examples/data-objects/table-document/eslint.config.mts index 4a056adcdb24..1dda96d5c927 100644 --- a/examples/data-objects/table-document/eslint.config.mts +++ b/examples/data-objects/table-document/eslint.config.mts @@ -3,21 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-deprecated": "off", // This package as a whole is deprecated so it uses deprecated APIs +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + rules: { + "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks + "@typescript-eslint/strict-boolean-expressions": "off", + // This package as a whole is deprecated so it uses deprecated APIs + "import-x/no-deprecated": "off", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/table-tree/eslint.config.mts b/examples/data-objects/table-tree/eslint.config.mts index af17d4e94059..a2e69a55d292 100644 --- a/examples/data-objects/table-tree/eslint.config.mts +++ b/examples/data-objects/table-tree/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/todo/eslint.config.mts b/examples/data-objects/todo/eslint.config.mts index 35b70a28a67b..e86456964e63 100644 --- a/examples/data-objects/todo/eslint.config.mts +++ b/examples/data-objects/todo/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/data-objects/webflow/eslint.config.mts b/examples/data-objects/webflow/eslint.config.mts index 9330c14889d5..95a38b9736c2 100644 --- a/examples/data-objects/webflow/eslint.config.mts +++ b/examples/data-objects/webflow/eslint.config.mts @@ -3,48 +3,49 @@ * Licensed under the MIT License. */ -const { +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig, { importInternalModulesAllowed, importInternalModulesAllowedForTest, -} = require("../../.eslintrc.data.cjs"); +} from "../../eslint.config.data.mts"; -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-internal-modules": [ - "error", - { - // package hasn't converted to barrel files (which may not be a bad thing) - allow: importInternalModulesAllowed.concat(["*/*.js"]), - }, - ], - "max-len": "off", - "no-bitwise": "off", - "no-case-declarations": "off", +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-internal-modules": [ + "error", + { + // package hasn't converted to barrel files (which may not be a bad thing) + allow: [...importInternalModulesAllowed, "*/*.js"], + }, + ], + "max-len": "off", + "no-bitwise": "off", + "no-case-declarations": "off", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", - }, - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, - // This should not be needed. For some reason no overrides from "../../.eslintrc.cjs" come thru. - overrides: [ - { - files: ["*.spec.ts", "src/test/**"], - rules: { - "import-x/no-internal-modules": [ - "error", - { allow: importInternalModulesAllowedForTest }, - ], - }, + + // This should not be needed. For some reason no overrides from "../../eslint.config.data.mts" come thru. + { + files: ["*.spec.ts", "src/test/**"], + rules: { + "import-x/no-internal-modules": [ + "error", + { + allow: [...importInternalModulesAllowedForTest], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/examples/eslint.config.data.mts b/examples/eslint.config.data.mts index 7d28e30a1a1f..66e98d14b682 100644 --- a/examples/eslint.config.data.mts +++ b/examples/eslint.config.data.mts @@ -3,10 +3,18 @@ * Licensed under the MIT License. */ -// To facilitate reuse of configuration elements this module exports some -// pieces of configuration and composed configuration. +/** + * Shared ESLint configuration for examples. + * Extend this in child package eslint.config.mts files to avoid duplicating common rules. + * Named exports (e.g., importInternalModulesAllowed) can be imported and extended by consumers. + */ + +import type { Linter } from "eslint"; -const importInternalModulesAllowed = [ +/** + * Patterns allowed for internal module imports in examples. + */ +export const importInternalModulesAllowed: string[] = [ // Allow import of Fluid Framework external API exports. "@fluidframework/*/{beta,alpha,legacy,legacy/alpha}", "fluid-framework/{beta,alpha,legacy,legacy/alpha}", @@ -26,7 +34,12 @@ const importInternalModulesAllowed = [ "*/index.js", ]; -const importInternalModulesAllowedForTest = importInternalModulesAllowed.concat([ +/** + * Extended patterns for test files, including additional internal imports. + */ +export const importInternalModulesAllowedForTest: string[] = [ + ...importInternalModulesAllowed, + // TODO #26906: `test-utils` internal used in examples (test) // Should `test-utils` provide support through `/test-utils` instead of `/internal`? "@fluidframework/test-utils/internal", @@ -34,38 +47,34 @@ const importInternalModulesAllowedForTest = importInternalModulesAllowed.concat( // Allow internal reaching within test directories. // (And also some external packages that aren't setup as modules.) "*/*.js", -]); +]; -const lintConfig = { - rules: { - /** - * Allow Fluid Framework examples to import from unstable and legacy APIs. - * https://github.com/import-js/eslint-plugin-import-x/blob/main/docs/rules/no-internal-modules.md - */ - "import-x/no-internal-modules": [ - "error", - { - allow: importInternalModulesAllowed, - }, - ], +const config: Linter.Config[] = [ + { + rules: { + /** + * Allow Fluid Framework examples to import from unstable and legacy APIs. + * @see https://github.com/import-js/eslint-plugin-import-x/blob/main/docs/rules/no-internal-modules.md + */ + "import-x/no-internal-modules": [ + "error", + { + allow: importInternalModulesAllowed, + }, + ], + }, }, - overrides: [ - { - files: ["*.spec.ts", "src/test/**", "tests/**"], - rules: { - "import-x/no-internal-modules": [ - "error", - { - allow: importInternalModulesAllowedForTest, - }, - ], - }, + { + files: ["*.spec.ts", "src/test/**", "tests/**"], + rules: { + "import-x/no-internal-modules": [ + "error", + { + allow: importInternalModulesAllowedForTest, + }, + ], }, - ], -}; + }, +]; -module.exports = { - importInternalModulesAllowed: importInternalModulesAllowed, - importInternalModulesAllowedForTest: importInternalModulesAllowedForTest, - lintConfig: lintConfig, -}; +export default config; diff --git a/examples/external-data/eslint.config.mts b/examples/external-data/eslint.config.mts index 9bd1f9c754b5..8f3b22769eef 100644 --- a/examples/external-data/eslint.config.mts +++ b/examples/external-data/eslint.config.mts @@ -3,61 +3,70 @@ * Licensed under the MIT License. */ -const { importInternalModulesAllowedForTest } = require("../.eslintrc.data.cjs"); +import type { Linter } from "eslint"; +import { recommended } from "../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig, { importInternalModulesAllowedForTest } from "../eslint.config.data.mts"; -module.exports = { - plugins: ["react", "react-hooks"], - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "prettier", - "../.eslintrc.cjs", - ], - rules: { - "import-x/no-nodejs-modules": ["error", { allow: ["node:http"] }], - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", - - // TODO: These rules should be re-enabled once we are on eslint 9 - // and the react plugins are upgraded to more recent versions - "react-hooks/immutability": "warn", - "react-hooks/refs": "warn", - "react-hooks/rules-of-hooks": "warn", - "react-hooks/set-state-in-effect": "warn", - "react-hooks/static-components": "warn", +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:http"], + }, + ], + "depend/ban-dependencies": [ + "error", + { + allowed: ["lodash.isequal"], + }, + ], + }, + }, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", - "depend/ban-dependencies": [ - "error", - { - allowed: ["lodash.isequal"], - }, - ], + // TODO: These rules should be re-enabled once we are on eslint 9 + // and the react plugins are upgraded to more recent versions + "react-hooks/immutability": "warn", + "react-hooks/refs": "warn", + "react-hooks/rules-of-hooks": "warn", + "react-hooks/set-state-in-effect": "warn", + "react-hooks/static-components": "warn", + }, }, - overrides: [ - { - files: ["tests/**"], - rules: { - // Fine for tests to import from dev dependencies - "import-x/no-extraneous-dependencies": ["error", { devDependencies: true }], + { + files: ["tests/**"], + rules: { + // Fine for tests to import from dev dependencies + "import-x/no-extraneous-dependencies": [ + "error", + { + devDependencies: true, + }, + ], - // Since the "tests" directory is adjacent to "src", and this package (intentionally) does not expose - // a single exports roll-up, reaching into "src" is required. - "import-x/no-internal-modules": [ - "error", - { allow: importInternalModulesAllowedForTest.concat(["**/src/*/*.js"]) }, - ], + // Since the "tests" directory is adjacent to "src", and this package (intentionally) does not expose + // a single exports roll-up, reaching into "src" is required. + "import-x/no-internal-modules": [ + "error", + { + allow: [...importInternalModulesAllowedForTest, "**/src/*/*.js"], + }, + ], - // Fine for tests to use node.js modules. - // Tests will ensure our webpack configuration is correctly set up to support any that we use. - "import-x/no-nodejs-modules": "off", - }, - }, - ], - settings: { - react: { - version: "detect", + // Fine for tests to use node.js modules. + // Tests will ensure our webpack configuration is correctly set up to support any that we use. + "import-x/no-nodejs-modules": "off", }, }, -}; +]; + +export default config; diff --git a/examples/service-clients/azure-client/external-controller/eslint.config.mts b/examples/service-clients/azure-client/external-controller/eslint.config.mts index 50bf48fafedc..4dae1568290c 100644 --- a/examples/service-clients/azure-client/external-controller/eslint.config.mts +++ b/examples/service-clients/azure-client/external-controller/eslint.config.mts @@ -3,19 +3,28 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "../../../.eslintrc.cjs"], - rules: { - // Demoted to warning as a workaround to layer-check challenges. Tracked by: - // https://github.com/microsoft/FluidFramework/issues/10226 - "import-x/no-extraneous-dependencies": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; - // Incompatible with prettier - // TODO: this can be removed once the eslint config is updated to version 5.4.0 or greater. - "unicorn/number-literal-case": "off", +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + rules: { + // Demoted to warning as a workaround to layer-check challenges. Tracked by: + // https://github.com/microsoft/FluidFramework/issues/10226 + "import-x/no-extraneous-dependencies": "warn", - // Incompatible with formatter - // TODO: this can be removed once the eslint config is updated to version 5.4.0 or greater. - "@typescript-eslint/brace-style": "off", + // Incompatible with prettier + // TODO: this can be removed once the eslint config is updated to version 5.4.0 or greater. + "unicorn/number-literal-case": "off", + + // Incompatible with formatter + // TODO: this can be removed once the eslint config is updated to version 5.4.0 or greater. + "@typescript-eslint/brace-style": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/service-clients/azure-client/todo-list/eslint.config.mts b/examples/service-clients/azure-client/todo-list/eslint.config.mts index 61505714242e..129bb5471f2f 100644 --- a/examples/service-clients/azure-client/todo-list/eslint.config.mts +++ b/examples/service-clients/azure-client/todo-list/eslint.config.mts @@ -3,14 +3,20 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/strict"), - "../../../.eslintrc.cjs", - ], - rules: { - // Demoted to warning as a workaround to layer-check challenges. Tracked by: - // https://github.com/microsoft/FluidFramework/issues/10226 - "import-x/no-extraneous-dependencies": "warn", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...strict, + ...sharedConfig, + { + rules: { + // Demoted to warning as a workaround to layer-check challenges. Tracked by: + // https://github.com/microsoft/FluidFramework/issues/10226 + "import-x/no-extraneous-dependencies": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/service-clients/odsp-client/shared-tree-demo/eslint.config.mts b/examples/service-clients/odsp-client/shared-tree-demo/eslint.config.mts index 2dd3239b8d92..bde6b9d545ec 100644 --- a/examples/service-clients/odsp-client/shared-tree-demo/eslint.config.mts +++ b/examples/service-clients/odsp-client/shared-tree-demo/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/recommended"), - "prettier", - "../../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/utils/bundle-size-tests/eslint.config.mts b/examples/utils/bundle-size-tests/eslint.config.mts index b69b556acdcf..9d4acdf20297 100644 --- a/examples/utils/bundle-size-tests/eslint.config.mts +++ b/examples/utils/bundle-size-tests/eslint.config.mts @@ -3,20 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - // There are a lot of intentional internal APIs leveraged here for simplicity. Skip common example rules: - // "../../.eslintrc.cjs", - ], - rules: {}, - overrides: [ - { - files: ["src/test/**/*"], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - }, - ], -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +// There are a lot of intentional internal APIs leveraged here for simplicity. Skip common example rules: +// (Does not extend ../../eslint.config.data.mts) +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + files: ["src/test/**/*"], + }, +]; + +export default config; diff --git a/examples/utils/example-driver/eslint.config.mts b/examples/utils/example-driver/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/utils/example-driver/eslint.config.mts +++ b/examples/utils/example-driver/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/utils/example-utils/eslint.config.mts b/examples/utils/example-utils/eslint.config.mts index c3e9d34db916..c13240a4ee22 100644 --- a/examples/utils/example-utils/eslint.config.mts +++ b/examples/utils/example-utils/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...recommended, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/examples/utils/example-webpack-integration/eslint.config.mts b/examples/utils/example-webpack-integration/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/utils/example-webpack-integration/eslint.config.mts +++ b/examples/utils/example-webpack-integration/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/utils/import-testing/eslint.config.mts b/examples/utils/import-testing/eslint.config.mts index 42e9cdc4ba99..786003032827 100644 --- a/examples/utils/import-testing/eslint.config.mts +++ b/examples/utils/import-testing/eslint.config.mts @@ -3,13 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/strict"), - "prettier", - "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...strict, ...sharedConfig]; + +export default config; diff --git a/examples/utils/migration-tools/eslint.config.mts b/examples/utils/migration-tools/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/utils/migration-tools/eslint.config.mts +++ b/examples/utils/migration-tools/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/utils/webpack-fluid-loader/eslint.config.mts b/examples/utils/webpack-fluid-loader/eslint.config.mts index f0273be5d3a6..9ffb26c1c25b 100644 --- a/examples/utils/webpack-fluid-loader/eslint.config.mts +++ b/examples/utils/webpack-fluid-loader/eslint.config.mts @@ -3,21 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - // There are a lot of internal APIs leveraged here. - // "../../.eslintrc.cjs", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": "off", - "no-case-declarations": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +// There are a lot of internal APIs leveraged here. +// (Does not extend ../../eslint.config.data.mts) +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-nodejs-modules": "off", + "no-case-declarations": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/version-migration/live-schema-upgrade/eslint.config.mts b/examples/version-migration/live-schema-upgrade/eslint.config.mts index db9f69036cb1..736dfea1bf6a 100644 --- a/examples/version-migration/live-schema-upgrade/eslint.config.mts +++ b/examples/version-migration/live-schema-upgrade/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...minimalDeprecated, ...sharedConfig]; + +export default config; diff --git a/examples/version-migration/same-container/eslint.config.mts b/examples/version-migration/same-container/eslint.config.mts index db9f69036cb1..736dfea1bf6a 100644 --- a/examples/version-migration/same-container/eslint.config.mts +++ b/examples/version-migration/same-container/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...minimalDeprecated, ...sharedConfig]; + +export default config; diff --git a/examples/version-migration/separate-container/eslint.config.mts b/examples/version-migration/separate-container/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/version-migration/separate-container/eslint.config.mts +++ b/examples/version-migration/separate-container/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/version-migration/tree-shim/eslint.config.mts b/examples/version-migration/tree-shim/eslint.config.mts index 35b70a28a67b..e86456964e63 100644 --- a/examples/version-migration/tree-shim/eslint.config.mts +++ b/examples/version-migration/tree-shim/eslint.config.mts @@ -3,13 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/examples/view-integration/container-views/eslint.config.mts b/examples/view-integration/container-views/eslint.config.mts index db9f69036cb1..736dfea1bf6a 100644 --- a/examples/view-integration/container-views/eslint.config.mts +++ b/examples/view-integration/container-views/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...minimalDeprecated, ...sharedConfig]; + +export default config; diff --git a/examples/view-integration/external-views/eslint.config.mts b/examples/view-integration/external-views/eslint.config.mts index a32f9b504a55..354f906de6ce 100644 --- a/examples/view-integration/external-views/eslint.config.mts +++ b/examples/view-integration/external-views/eslint.config.mts @@ -3,11 +3,10 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [...recommended, ...sharedConfig]; + +export default config; diff --git a/examples/view-integration/view-framework-sampler/eslint.config.mts b/examples/view-integration/view-framework-sampler/eslint.config.mts index bb31967df6fe..07749f43cd9f 100644 --- a/examples/view-integration/view-framework-sampler/eslint.config.mts +++ b/examples/view-integration/view-framework-sampler/eslint.config.mts @@ -3,15 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - "../../.eslintrc.cjs", - ], - rules: { - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; +import sharedConfig from "../../eslint.config.data.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + ...sharedConfig, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + }, }, -}; +]; + +export default config; diff --git a/experimental/PropertyDDS/packages/property-changeset/eslint.config.mts b/experimental/PropertyDDS/packages/property-changeset/eslint.config.mts index 7b9742aaccb9..4e854a61f98a 100644 --- a/experimental/PropertyDDS/packages/property-changeset/eslint.config.mts +++ b/experimental/PropertyDDS/packages/property-changeset/eslint.config.mts @@ -3,65 +3,65 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // Many rules are disabled in PropertyDDS projects. See https://github.com/microsoft/FluidFramework/pull/10272 - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/consistent-type-definitions": "off", - "@typescript-eslint/dot-notation": "off", - "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/no-dynamic-delete": "off", - "@typescript-eslint/no-invalid-this": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-empty-object-type": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-shadow": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-unnecessary-qualifier": "off", - "@typescript-eslint/no-unnecessary-type-assertion": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unused-expressions": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/prefer-for-of": "off", - "@typescript-eslint/prefer-includes": "off", - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/prefer-optional-chain": "off", - "@typescript-eslint/prefer-readonly": "off", - "@typescript-eslint/restrict-plus-operands": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "@typescript-eslint/unbound-method": "off", - "eqeqeq": "off", - "import-x/no-internal-modules": "off", - "no-case-declarations": "off", - "no-inner-declarations": "off", - "no-multi-spaces": "off", - "no-param-reassign": "off", - "no-prototype-builtins": "off", - "no-useless-escape": "off", - "no-var": "off", - "prefer-arrow-callback": "off", - "prefer-const": "off", - "prefer-template": "off", - "quote-props": "off", - "tsdoc/syntax": "off", - "unicorn/better-regex": "off", - "unicorn/filename-case": "off", - "depend/ban-dependencies": [ - "error", - { - allowed: ["lodash", "traverse"], - }, - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + // Many rules are disabled in PropertyDDS projects. See https://github.com/microsoft/FluidFramework/pull/10272 + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/no-dynamic-delete": "off", + "@typescript-eslint/no-invalid-this": "off", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-empty-object-type": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/no-shadow": "off", + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/no-unnecessary-qualifier": "off", + "@typescript-eslint/no-unnecessary-type-assertion": "off", + "@typescript-eslint/no-unsafe-function-type": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unused-expressions": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/prefer-for-of": "off", + "@typescript-eslint/prefer-includes": "off", + "@typescript-eslint/prefer-nullish-coalescing": "off", + "@typescript-eslint/prefer-optional-chain": "off", + "@typescript-eslint/prefer-readonly": "off", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/unbound-method": "off", + eqeqeq: "off", + "import-x/no-internal-modules": "off", + "no-case-declarations": "off", + "no-inner-declarations": "off", + "no-multi-spaces": "off", + "no-param-reassign": "off", + "no-prototype-builtins": "off", + "no-useless-escape": "off", + "no-var": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-template": "off", + "quote-props": "off", + "tsdoc/syntax": "off", + "unicorn/better-regex": "off", + "unicorn/filename-case": "off", + "depend/ban-dependencies": [ + "error", + { + allowed: ["lodash", "traverse"], + }, + ], + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/experimental/PropertyDDS/packages/property-common/eslint.config.mts b/experimental/PropertyDDS/packages/property-common/eslint.config.mts index be0bf440991c..97a286a1c7c3 100644 --- a/experimental/PropertyDDS/packages/property-common/eslint.config.mts +++ b/experimental/PropertyDDS/packages/property-common/eslint.config.mts @@ -3,24 +3,25 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/explicit-function-return-type": "warn", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - "prefer-arrow-callback": "off", - "tsdoc/syntax": "off", - "depend/ban-dependencies": [ - "error", - { - allowed: ["lodash"], - }, - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/explicit-function-return-type": "warn", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + "prefer-arrow-callback": "off", + "tsdoc/syntax": "off", + "depend/ban-dependencies": [ + "error", + { + allowed: ["lodash"], + }, + ], + }, }, -}; +]; + +export default config; diff --git a/experimental/PropertyDDS/packages/property-dds/eslint.config.mts b/experimental/PropertyDDS/packages/property-dds/eslint.config.mts index 768428230082..c3e20b8944d7 100644 --- a/experimental/PropertyDDS/packages/property-dds/eslint.config.mts +++ b/experimental/PropertyDDS/packages/property-dds/eslint.config.mts @@ -3,24 +3,25 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/strict-boolean-expressions": "off", - "tsdoc/syntax": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - "depend/ban-dependencies": [ - "error", - { - allowed: ["axios", "lodash"], - }, - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/strict-boolean-expressions": "off", + "tsdoc/syntax": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + "depend/ban-dependencies": [ + "error", + { + allowed: ["axios", "lodash"], + }, + ], + }, }, -}; +]; + +export default config; diff --git a/experimental/PropertyDDS/packages/property-properties/eslint.config.mts b/experimental/PropertyDDS/packages/property-properties/eslint.config.mts index 23ef5c108eec..e31d805e8574 100644 --- a/experimental/PropertyDDS/packages/property-properties/eslint.config.mts +++ b/experimental/PropertyDDS/packages/property-properties/eslint.config.mts @@ -3,67 +3,70 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // Many rules are disabled in PropertyDDS projects. See https://github.com/microsoft/FluidFramework/pull/10272 - "@typescript-eslint/dot-notation": "off", - "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/no-dynamic-delete": "off", - "@typescript-eslint/no-extraneous-class": "off", - "@typescript-eslint/no-implied-eval": "off", - "@typescript-eslint/no-invalid-this": "off", - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-shadow": "off", - "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-unnecessary-type-assertion": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unused-expressions": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/prefer-for-of": "off", - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/prefer-optional-chain": "off", - "@typescript-eslint/restrict-plus-operands": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "@typescript-eslint/unbound-method": "off", - "guard-for-in": "off", - "import-x/no-duplicates": "off", - "import-x/no-extraneous-dependencies": "off", - "import-x/no-internal-modules": "off", - "max-len": "off", - "no-bitwise": "off", - "no-new-func": "off", - "no-param-reassign": "off", - "no-prototype-builtins": "off", - "no-undef": "off", - "no-undef-init": "off", - "no-var": "off", - "object-shorthand": "off", - "one-var": "off", - "prefer-arrow-callback": "off", - "prefer-const": "off", - "prefer-object-spread": "off", - "prefer-template": "off", - "quote-props": "off", - "tsdoc/syntax": "off", - "unicorn/better-regex": "off", - "depend/ban-dependencies": [ - "error", - { - allowed: ["lodash", "underscore"], - }, - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + ignores: ["src/index.d.ts"], + }, + { + rules: { + // Many rules are disabled in PropertyDDS projects. See https://github.com/microsoft/FluidFramework/pull/10272 + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/no-dynamic-delete": "off", + "@typescript-eslint/no-extraneous-class": "off", + "@typescript-eslint/no-implied-eval": "off", + "@typescript-eslint/no-invalid-this": "off", + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/no-shadow": "off", + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/no-unnecessary-type-assertion": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unused-expressions": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/prefer-for-of": "off", + "@typescript-eslint/prefer-nullish-coalescing": "off", + "@typescript-eslint/prefer-optional-chain": "off", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/unbound-method": "off", + "guard-for-in": "off", + "import-x/no-duplicates": "off", + "import-x/no-extraneous-dependencies": "off", + "import-x/no-internal-modules": "off", + "max-len": "off", + "no-bitwise": "off", + "no-new-func": "off", + "no-param-reassign": "off", + "no-prototype-builtins": "off", + "no-undef": "off", + "no-undef-init": "off", + "no-var": "off", + "object-shorthand": "off", + "one-var": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-object-spread": "off", + "prefer-template": "off", + "quote-props": "off", + "tsdoc/syntax": "off", + "unicorn/better-regex": "off", + "depend/ban-dependencies": [ + "error", + { + allowed: ["lodash", "underscore"], + }, + ], + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/experimental/dds/ot/ot/eslint.config.mts b/experimental/dds/ot/ot/eslint.config.mts index 3514825ac914..4d66d1b596e7 100644 --- a/experimental/dds/ot/ot/eslint.config.mts +++ b/experimental/dds/ot/ot/eslint.config.mts @@ -3,12 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...minimalDeprecated]; + +export default config; diff --git a/experimental/dds/ot/sharejs/json1/eslint.config.mts b/experimental/dds/ot/sharejs/json1/eslint.config.mts index 3514825ac914..fa3b232f2bde 100644 --- a/experimental/dds/ot/sharejs/json1/eslint.config.mts +++ b/experimental/dds/ot/sharejs/json1/eslint.config.mts @@ -3,12 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...minimalDeprecated]; + +export default config; diff --git a/experimental/dds/sequence-deprecated/eslint.config.mts b/experimental/dds/sequence-deprecated/eslint.config.mts index 84582da3fecf..aa4df4792857 100644 --- a/experimental/dds/sequence-deprecated/eslint.config.mts +++ b/experimental/dds/sequence-deprecated/eslint.config.mts @@ -3,17 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-deprecated": "off", // This package uses deprecated APIs by design. - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "import-x/no-deprecated": "off", // This package uses deprecated APIs by design. + "jsdoc/require-description": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/experimental/dds/tree/eslint.config.mts b/experimental/dds/tree/eslint.config.mts index 7ccb1e9f4439..a03639f49846 100644 --- a/experimental/dds/tree/eslint.config.mts +++ b/experimental/dds/tree/eslint.config.mts @@ -3,44 +3,48 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ['@fluidframework/eslint-config-fluid/minimal-deprecated', 'prettier'], - root: true, - rules: { - // TODO: Recover "noUnusedLocals" behavior as part of linting. (This rule seems to be broken in the Fluid repo.) - // '@typescript-eslint/no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }], +import type { Linter } from 'eslint'; +import { minimalDeprecated } from '../../../common/build/eslint-config-fluid/flat.mts'; - // This package is effectively deprecated. The below rules are disabled for ease of migration and will not be enabled. - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-shadow': 'off', - 'no-shadow': 'off', - '@typescript-eslint/no-unsafe-return': 'off', - 'import-x/no-deprecated': 'off', - '@fluid-internal/fluid/no-unchecked-record-access': 'off', +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + // TODO: Recover "noUnusedLocals" behavior as part of linting. (This rule seems to be broken in the Fluid repo.) + // '@typescript-eslint/no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }], + + // This package is effectively deprecated. The below rules are disabled for ease of migration and will not be enabled. + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-shadow': 'off', + 'no-shadow': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + 'import-x/no-deprecated': 'off', + '@fluid-internal/fluid/no-unchecked-record-access': 'off', + }, }, - overrides: [ - { - files: ['src/test/**'], - rules: { - // Chai assertions trigger the unused expression lint rule. - '@typescript-eslint/no-unused-expressions': 'off', + { + files: ['src/test/**'], + rules: { + // Chai assertions trigger the unused expression lint rule. + '@typescript-eslint/no-unused-expressions': 'off', - // Dev dependencies and internal modules may be used in test code - 'import-x/no-extraneous-dependencies': [ - 'error', - { - devDependencies: true, - }, - ], - 'import-x/no-internal-modules': 'off', - }, + // Dev dependencies and internal modules may be used in test code + 'import-x/no-extraneous-dependencies': [ + 'error', + { + devDependencies: true, + }, + ], + 'import-x/no-internal-modules': 'off', }, - { - files: ['**/test/**', 'src/index.ts'], - rules: { - // Test code and the main package export shouldn't be linted for unused exports - 'import-x/no-unused-modules': 'off', - }, + }, + { + files: ['**/test/**', 'src/index.ts'], + rules: { + // Test code and the main package export shouldn't be linted for unused exports + 'import-x/no-unused-modules': 'off', }, - ], -}; + }, +]; + +export default config; diff --git a/experimental/framework/data-objects/eslint.config.mts b/experimental/framework/data-objects/eslint.config.mts index 70450aa83eba..6b3f1fc82e9c 100644 --- a/experimental/framework/data-objects/eslint.config.mts +++ b/experimental/framework/data-objects/eslint.config.mts @@ -3,25 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/experimental/framework/last-edited/eslint.config.mts b/experimental/framework/last-edited/eslint.config.mts index 484c63b7e874..b28d77a87f58 100644 --- a/experimental/framework/last-edited/eslint.config.mts +++ b/experimental/framework/last-edited/eslint.config.mts @@ -3,7 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/common/client-utils/eslint.config.mts b/packages/common/client-utils/eslint.config.mts index 783ccaa1442d..67aba1755f13 100644 --- a/packages/common/client-utils/eslint.config.mts +++ b/packages/common/client-utils/eslint.config.mts @@ -3,14 +3,28 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: [ - "./tsconfig.json", - "./src/test/mocha/tsconfig.json", - "./src/test/jest/tsconfig.cjs.json", - "./src/test/types/tsconfig.json", - ], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This package has non-standard test directories (mocha/, jest/, types/) that + // typescript-eslint's projectService can't auto-discover. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: [ + "./tsconfig.json", + "./src/test/mocha/tsconfig.json", + "./src/test/jest/tsconfig.cjs.json", + "./src/test/types/tsconfig.json", + ], + }, + }, }, -}; +]; + +export default config; diff --git a/packages/common/container-definitions/eslint.config.mts b/packages/common/container-definitions/eslint.config.mts index 14b1d702c497..032e7444ad41 100644 --- a/packages/common/container-definitions/eslint.config.mts +++ b/packages/common/container-definitions/eslint.config.mts @@ -3,26 +3,33 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: Enabling this may require breaking changes. - "@typescript-eslint/consistent-indexed-object-style": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // TODO: Enabling this may require breaking changes. + "@typescript-eslint/consistent-indexed-object-style": "off", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/common/core-interfaces/eslint.config.mts b/packages/common/core-interfaces/eslint.config.mts index 77235d25d2b7..a1eb68319ce3 100644 --- a/packages/common/core-interfaces/eslint.config.mts +++ b/packages/common/core-interfaces/eslint.config.mts @@ -3,31 +3,47 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: [ - "./tsconfig.json", - "./src/test/tsconfig.json", - "./src/test/tsconfig.no-exactOptionalPropertyTypes.json", - ], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // TODO: Enabling this may require breaking changes. + "@typescript-eslint/consistent-indexed-object-style": "off", + }, }, - rules: { - // TODO: Enabling this may require breaking changes. - "@typescript-eslint/consistent-indexed-object-style": "off", + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + "import-x/no-internal-modules": [ + "error", + { + allow: ["@fluidframework/*/internal{,/**}"], + }, + ], + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - "import-x/no-internal-modules": [ - "error", - { - "allow": ["@fluidframework/*/internal{,/**}"], - }, + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This package has a special tsconfig (tsconfig.no-exactOptionalPropertyTypes.json) for + // testing exactOptionalPropertyTypes=false. That file is excluded from the main test + // tsconfig, so typescript-eslint's projectService can't discover it automatically. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: [ + "./tsconfig.json", + "./src/test/tsconfig.json", + "./src/test/tsconfig.no-exactOptionalPropertyTypes.json", ], }, }, - ], -}; + }, +]; + +export default config; diff --git a/packages/common/core-utils/eslint.config.mts b/packages/common/core-utils/eslint.config.mts index 2e997a33f2f5..fd085f0dbe93 100644 --- a/packages/common/core-utils/eslint.config.mts +++ b/packages/common/core-utils/eslint.config.mts @@ -3,28 +3,35 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // This has been disabled in the next eslint-config-fluid. - // Once the dependency here has been updated, this override can be removed. - "unicorn/numeric-separators-style": "off", +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // This has been disabled in the next eslint-config-fluid. + // Once the dependency here has been updated, this override can be removed. + "unicorn/numeric-separators-style": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "*.test.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert", "node:process"] }], - // Does not work well with describe/it block scoping - "unicorn/consistent-function-scoping": "off", - }, + // Rules only for test files + { + files: ["*.spec.ts", "*.test.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:process"], + }, + ], + + // Does not work well with describe/it block scoping + "unicorn/consistent-function-scoping": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/common/driver-definitions/eslint.config.mts b/packages/common/driver-definitions/eslint.config.mts index 7e0b98ddbd21..b2425d9da728 100644 --- a/packages/common/driver-definitions/eslint.config.mts +++ b/packages/common/driver-definitions/eslint.config.mts @@ -3,10 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - rules: { - // TODO: Enabling this may require breaking changes. - "@typescript-eslint/consistent-indexed-object-style": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // TODO: Enabling this may require breaking changes. + "@typescript-eslint/consistent-indexed-object-style": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/dds/cell/eslint.config.mts b/packages/dds/cell/eslint.config.mts index bbfed2e4231c..4b2fa5f4add5 100644 --- a/packages/dds/cell/eslint.config.mts +++ b/packages/dds/cell/eslint.config.mts @@ -3,13 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes. - "unicorn/numeric-separators-style": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes. + "unicorn/numeric-separators-style": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/dds/counter/eslint.config.mts b/packages/dds/counter/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/dds/counter/eslint.config.mts +++ b/packages/dds/counter/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/dds/ink/eslint.config.mts b/packages/dds/ink/eslint.config.mts index 83e6fc398495..b28d77a87f58 100644 --- a/packages/dds/ink/eslint.config.mts +++ b/packages/dds/ink/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/dds/legacy-dds/eslint.config.mts b/packages/dds/legacy-dds/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/dds/legacy-dds/eslint.config.mts +++ b/packages/dds/legacy-dds/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/dds/map/eslint.config.mts b/packages/dds/map/eslint.config.mts index c3fd19a9ba22..706d44bb8cdd 100644 --- a/packages/dds/map/eslint.config.mts +++ b/packages/dds/map/eslint.config.mts @@ -3,26 +3,28 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", - // TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes. - "unicorn/numeric-separators-style": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", + // TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes. + "unicorn/numeric-separators-style": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, - overrides: [ - { - files: ["src/test/**"], - rules: { - // Allow tests (which only run in Node.js) use `__dirname` - "unicorn/prefer-module": "off", - }, + { + files: ["src/test/**"], + rules: { + // Allow tests (which only run in Node.js) use `__dirname` + "unicorn/prefer-module": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/dds/matrix/eslint.config.mts b/packages/dds/matrix/eslint.config.mts index 1319083a098e..f19e21ce86fe 100644 --- a/packages/dds/matrix/eslint.config.mts +++ b/packages/dds/matrix/eslint.config.mts @@ -3,24 +3,31 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove this override and fix violations - "@typescript-eslint/no-shadow": "off", +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove this override and fix violations + "@typescript-eslint/no-shadow": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert", "node:path"] }], - }, + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:path"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/dds/merge-tree/eslint.config.mts b/packages/dds/merge-tree/eslint.config.mts index 44207e07525f..d5dfa74bdf64 100644 --- a/packages/dds/merge-tree/eslint.config.mts +++ b/packages/dds/merge-tree/eslint.config.mts @@ -3,17 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "keyword-spacing": "off", // Off because it conflicts with typescript-formatter - "no-case-declarations": "off", - "prefer-arrow/prefer-arrow-functions": "off", - "unicorn/no-useless-spread": "off", // Off because it generates incorrect code in autofixes and cannot distinguish useful copies of arrays from useless ones +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "keyword-spacing": "off", // Off because it conflicts with typescript-formatter + "no-case-declarations": "off", + "prefer-arrow/prefer-arrow-functions": "off", + "unicorn/no-useless-spread": "off", // Off because it generates incorrect code in autofixes and cannot distinguish useful copies of arrays from useless ones + }, }, -}; +]; + +export default config; diff --git a/packages/dds/ordered-collection/eslint.config.mts b/packages/dds/ordered-collection/eslint.config.mts index 7e30fd05f3d8..b28d77a87f58 100644 --- a/packages/dds/ordered-collection/eslint.config.mts +++ b/packages/dds/ordered-collection/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/dds/pact-map/eslint.config.mts b/packages/dds/pact-map/eslint.config.mts index d9b31655dbb8..1740790c4ee4 100644 --- a/packages/dds/pact-map/eslint.config.mts +++ b/packages/dds/pact-map/eslint.config.mts @@ -3,19 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/strict", "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert"] }], - }, +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/dds/register-collection/eslint.config.mts b/packages/dds/register-collection/eslint.config.mts index 3514825ac914..cb5255b96738 100644 --- a/packages/dds/register-collection/eslint.config.mts +++ b/packages/dds/register-collection/eslint.config.mts @@ -3,12 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...minimalDeprecated]; + +export default config; diff --git a/packages/dds/sequence/eslint.config.mts b/packages/dds/sequence/eslint.config.mts index c1487fc21269..361b4baafecd 100644 --- a/packages/dds/sequence/eslint.config.mts +++ b/packages/dds/sequence/eslint.config.mts @@ -3,54 +3,26 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // #region TODO: Fix violations and remove these rule disables - - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - - "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; - "prefer-arrow-callback": "off", +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + // #region TODO: Fix violations and remove these rule disables - // #endregion - }, - settings: { - "import-x/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"], - "import-x/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"], - }, - "import-x/resolver": { - typescript: { - extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx"], - conditionNames: [ - "allow-ff-test-exports", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // Default condition names below, see https://www.npmjs.com/package/eslint-import-resolver-typescript#conditionnames - "types", - "import", + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", - // APF: https://angular.io/guide/angular-package-format - "esm2020", - "es2020", - "es2015", + "prefer-arrow-callback": "off", - "require", - "node", - "node-addons", - "browser", - "default", - ], - }, + // #endregion }, }, -}; +]; + +export default config; diff --git a/packages/dds/shared-object-base/eslint.config.mts b/packages/dds/shared-object-base/eslint.config.mts index 83e6fc398495..b28d77a87f58 100644 --- a/packages/dds/shared-object-base/eslint.config.mts +++ b/packages/dds/shared-object-base/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/dds/shared-summary-block/eslint.config.mts b/packages/dds/shared-summary-block/eslint.config.mts index 83e6fc398495..b28d77a87f58 100644 --- a/packages/dds/shared-summary-block/eslint.config.mts +++ b/packages/dds/shared-summary-block/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/dds/task-manager/eslint.config.mts b/packages/dds/task-manager/eslint.config.mts index be34cd618e41..79516a2950be 100644 --- a/packages/dds/task-manager/eslint.config.mts +++ b/packages/dds/task-manager/eslint.config.mts @@ -3,23 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": [ - "error", - { allow: ["node:assert", "node:fs", "node:path"] }, - ], - }, +const config: Linter.Config[] = [ + ...strict, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:fs", "node:path"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/dds/test-dds-utils/eslint.config.mts b/packages/dds/test-dds-utils/eslint.config.mts index 8cba4bf9fe15..53d0e8c50966 100644 --- a/packages/dds/test-dds-utils/eslint.config.mts +++ b/packages/dds/test-dds-utils/eslint.config.mts @@ -3,26 +3,30 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove this override and fix violations - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove this override and fix violations + "@typescript-eslint/strict-boolean-expressions": "off", - // This package implements test utils to be run under Node.JS. - "import-x/no-nodejs-modules": "off", + // This package implements test utils to be run under Node.JS. + "import-x/no-nodejs-modules": "off", - "depend/ban-dependencies": [ - "error", - { - allowed: [ - // TODO: This package should use tinyexec or child_process directly instead of execa - "execa", - ], - }, - ], + "depend/ban-dependencies": [ + "error", + { + allowed: [ + // TODO: This package should use tinyexec or child_process directly instead of execa + "execa", + ], + }, + ], + }, }, -}; +]; + +export default config; diff --git a/packages/dds/tree/eslint.config.mts b/packages/dds/tree/eslint.config.mts index 7fdcf0c65a0c..2540273c19fe 100644 --- a/packages/dds/tree/eslint.config.mts +++ b/packages/dds/tree/eslint.config.mts @@ -3,100 +3,75 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-namespace": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; - // This library leverages empty, derived interface definitions to capture concepts - // in a nicely reusable way. - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-empty-object-type": "off", +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "@typescript-eslint/no-namespace": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", + // This library leverages empty, derived interface definitions to capture concepts + // in a nicely reusable way. + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-empty-object-type": "off", - // This package is build with noUnusedLocals disabled for a specific use case (see note in tsconfig.json), - // but should reject other cases using this rule: - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^", - varsIgnorePattern: "^_", - caughtErrorsIgnorePattern: "^_", - }, - ], + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // TODO: Remove this override once this config has been updated to extend the "strict" base config. - "@typescript-eslint/explicit-member-accessibility": "error", + // This package is build with noUnusedLocals disabled for a specific use case (see note in tsconfig.json), + // but should reject other cases using this rule: + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], - // #region TODO:AB#6983: Remove these overrides and fix violations + // TODO: Remove this override once this config has been updated to extend the "strict" base config. + "@typescript-eslint/explicit-member-accessibility": "error", - "@typescript-eslint/explicit-module-boundary-types": "off", + // #region TODO:AB#6983: Remove these overrides and fix violations - // Causes eslint to stack-overflow in this package. Will need investigation. - "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", - // Causes eslint to stack-overflow in this package. Will need investigation. - "@typescript-eslint/no-unsafe-assignment": "off", + // Causes eslint to stack-overflow in this package. Will need investigation. + "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", + // Causes eslint to stack-overflow in this package. Will need investigation. + "@typescript-eslint/no-unsafe-assignment": "off", - "import-x/order": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", - // Set to a warning to encourage adding docs :) - "jsdoc/require-description": "warn", + "import-x/order": "off", - "unicorn/consistent-function-scoping": "off", - "unicorn/no-array-method-this-argument": "off", - "unicorn/no-null": "off", - "unicorn/prefer-export-from": "off", - "unicorn/text-encoding-identifier-case": "off", + // Set to a warning to encourage adding docs :) + "jsdoc/require-description": "warn", - // #endregion - }, - overrides: [ - { - files: ["src/test/**/*"], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-unused-vars": ["off"], - "@typescript-eslint/explicit-function-return-type": "off", - }, - }, - ], - settings: { - "import/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"], - "import/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"], + "unicorn/consistent-function-scoping": "off", + "unicorn/no-array-method-this-argument": "off", + "unicorn/no-await-expression-member": "off", + "unicorn/no-null": "off", + "unicorn/prefer-export-from": "off", + "unicorn/text-encoding-identifier-case": "off", + + // #endregion }, - "import/resolver": { - typescript: { - extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx"], - conditionNames: [ - "allow-ff-test-exports", - - // Default condition names below, see https://www.npmjs.com/package/eslint-import-resolver-typescript#conditionnames - "types", - "import", - - // APF: https://angular.io/guide/angular-package-format - "esm2020", - "es2020", - "es2015", - - "require", - "node", - "node-addons", - "browser", - "default", - ], - }, + }, + { + files: ["src/test/**/*"], + rules: { + "@typescript-eslint/no-unused-vars": ["off"], + "@typescript-eslint/explicit-function-return-type": "off", + // Test files commonly define helper functions inside describe blocks for better readability + "unicorn/consistent-function-scoping": "off", + // Test files frequently use `as any` casts to access internal/hidden properties for testing + "@typescript-eslint/no-unsafe-member-access": "off", }, }, -}; +]; + +export default config; diff --git a/packages/drivers/debugger/eslint.config.mts b/packages/drivers/debugger/eslint.config.mts index e147ff179042..50d4626e55bf 100644 --- a/packages/drivers/debugger/eslint.config.mts +++ b/packages/drivers/debugger/eslint.config.mts @@ -3,16 +3,20 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": "off", - "no-inner-declarations": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-nodejs-modules": "off", + "no-inner-declarations": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/driver-base/eslint.config.mts b/packages/drivers/driver-base/eslint.config.mts index ee8ac3a3f778..d7035d66347c 100644 --- a/packages/drivers/driver-base/eslint.config.mts +++ b/packages/drivers/driver-base/eslint.config.mts @@ -3,15 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/driver-web-cache/eslint.config.mts b/packages/drivers/driver-web-cache/eslint.config.mts index d6f0d2d96cf4..204bf94e0957 100644 --- a/packages/drivers/driver-web-cache/eslint.config.mts +++ b/packages/drivers/driver-web-cache/eslint.config.mts @@ -3,22 +3,23 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "@typescript-eslint/promise-function-async": "off", - "@typescript-eslint/no-misused-promises": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/promise-function-async": "off", + "@typescript-eslint/no-misused-promises": "off", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/file-driver/eslint.config.mts b/packages/drivers/file-driver/eslint.config.mts index 08b8bacd50b5..afa028226f2b 100644 --- a/packages/drivers/file-driver/eslint.config.mts +++ b/packages/drivers/file-driver/eslint.config.mts @@ -3,13 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": ["error", { allow: ["fs"] }], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["fs"], + }, + ], + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/local-driver/eslint.config.mts b/packages/drivers/local-driver/eslint.config.mts index 1d8d6b6fe257..6b3f1fc82e9c 100644 --- a/packages/drivers/local-driver/eslint.config.mts +++ b/packages/drivers/local-driver/eslint.config.mts @@ -3,25 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/drivers/odsp-driver-definitions/eslint.config.mts b/packages/drivers/odsp-driver-definitions/eslint.config.mts index b3c5ed9a16c5..cb5255b96738 100644 --- a/packages/drivers/odsp-driver-definitions/eslint.config.mts +++ b/packages/drivers/odsp-driver-definitions/eslint.config.mts @@ -3,13 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...minimalDeprecated]; + +export default config; diff --git a/packages/drivers/odsp-driver/eslint.config.mts b/packages/drivers/odsp-driver/eslint.config.mts index e74d4616f9c5..83e83f26ff37 100644 --- a/packages/drivers/odsp-driver/eslint.config.mts +++ b/packages/drivers/odsp-driver/eslint.config.mts @@ -3,35 +3,38 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", - // This library uses and serializes "utf-8". - "unicorn/text-encoding-identifier-case": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", + // This library uses and serializes "utf-8". + "unicorn/text-encoding-identifier-case": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // It's valuable for tests to validate handling of `null` values, regardless of our API policies. - "unicorn/no-null": "off", - // Fine for tests to use `__dirname` - "unicorn/prefer-module": "off", - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // It's valuable for tests to validate handling of `null` values, regardless of our API policies. + "unicorn/no-null": "off", + + // Fine for tests to use `__dirname` + "unicorn/prefer-module": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/drivers/odsp-urlResolver/eslint.config.mts b/packages/drivers/odsp-urlResolver/eslint.config.mts index 1b011a398f98..73c06edf0a66 100644 --- a/packages/drivers/odsp-urlResolver/eslint.config.mts +++ b/packages/drivers/odsp-urlResolver/eslint.config.mts @@ -3,14 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/replay-driver/eslint.config.mts b/packages/drivers/replay-driver/eslint.config.mts index a8f260775d3c..a674c9b40e11 100644 --- a/packages/drivers/replay-driver/eslint.config.mts +++ b/packages/drivers/replay-driver/eslint.config.mts @@ -3,13 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/routerlicious-driver/eslint.config.mts b/packages/drivers/routerlicious-driver/eslint.config.mts index 934f52ee4e58..d373e1c7e8fb 100644 --- a/packages/drivers/routerlicious-driver/eslint.config.mts +++ b/packages/drivers/routerlicious-driver/eslint.config.mts @@ -3,21 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "no-case-declarations": "off", - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "no-case-declarations": "off", + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/drivers/routerlicious-urlResolver/eslint.config.mts b/packages/drivers/routerlicious-urlResolver/eslint.config.mts index 55c9544afbf2..1c2e869e49be 100644 --- a/packages/drivers/routerlicious-urlResolver/eslint.config.mts +++ b/packages/drivers/routerlicious-urlResolver/eslint.config.mts @@ -3,38 +3,43 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "unicorn/filename-case": [ - "error", - { - cases: { - camelCase: true, - pascalCase: true, +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + "unicorn/filename-case": [ + "error", + { + ignore: [".*routerlicious-urlResolver\\.spec\\.ts"], + cases: { + camelCase: true, + pascalCase: true, + }, }, - ignore: [/.*routerlicious-urlResolver\.spec\.ts/], - }, - ], + ], - // This library is used in the browser, so we don't want dependencies on most node libraries. - "import-x/no-nodejs-modules": ["error"], + // This library is used in the browser, so we don't want dependencies on most node libraries. + "import-x/no-nodejs-modules": ["error"], + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/drivers/tinylicious-driver/eslint.config.mts b/packages/drivers/tinylicious-driver/eslint.config.mts index 448127a19f18..5eaf3129acb7 100644 --- a/packages/drivers/tinylicious-driver/eslint.config.mts +++ b/packages/drivers/tinylicious-driver/eslint.config.mts @@ -3,13 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove this override and fix violations - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove this override and fix violations + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/agent-scheduler/eslint.config.mts b/packages/framework/agent-scheduler/eslint.config.mts index b0f361c5deb0..5eaf3129acb7 100644 --- a/packages/framework/agent-scheduler/eslint.config.mts +++ b/packages/framework/agent-scheduler/eslint.config.mts @@ -3,13 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove this override and fix violations - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove this override and fix violations + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/aqueduct/eslint.config.mts b/packages/framework/aqueduct/eslint.config.mts index 831eb9f65973..73391a7e3ba6 100644 --- a/packages/framework/aqueduct/eslint.config.mts +++ b/packages/framework/aqueduct/eslint.config.mts @@ -3,12 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/attributor/eslint.config.mts b/packages/framework/attributor/eslint.config.mts index bbf70804cb32..2c818935b796 100644 --- a/packages/framework/attributor/eslint.config.mts +++ b/packages/framework/attributor/eslint.config.mts @@ -3,23 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - "import-x/no-nodejs-modules": [ - "error", - { allow: ["node:assert", "node:fs", "node:path"] }, - ], - "unicorn/prefer-module": "off", - }, +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:fs", "node:path"], + }, + ], + "unicorn/prefer-module": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/framework/client-logger/app-insights-logger/eslint.config.mts b/packages/framework/client-logger/app-insights-logger/eslint.config.mts index d45cfb022230..d359442f3379 100644 --- a/packages/framework/client-logger/app-insights-logger/eslint.config.mts +++ b/packages/framework/client-logger/app-insights-logger/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/framework/client-logger/fluid-telemetry/eslint.config.mts b/packages/framework/client-logger/fluid-telemetry/eslint.config.mts index d45cfb022230..d359442f3379 100644 --- a/packages/framework/client-logger/fluid-telemetry/eslint.config.mts +++ b/packages/framework/client-logger/fluid-telemetry/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/framework/data-object-base/eslint.config.mts b/packages/framework/data-object-base/eslint.config.mts index c3bad505f132..73391a7e3ba6 100644 --- a/packages/framework/data-object-base/eslint.config.mts +++ b/packages/framework/data-object-base/eslint.config.mts @@ -3,12 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/dds-interceptions/eslint.config.mts b/packages/framework/dds-interceptions/eslint.config.mts index 83e6fc398495..b28d77a87f58 100644 --- a/packages/framework/dds-interceptions/eslint.config.mts +++ b/packages/framework/dds-interceptions/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/framework/fluid-framework/eslint.config.mts b/packages/framework/fluid-framework/eslint.config.mts index 1c9cf7e23d62..863f297b7ac3 100644 --- a/packages/framework/fluid-framework/eslint.config.mts +++ b/packages/framework/fluid-framework/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/strict", "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/framework/fluid-static/eslint.config.mts b/packages/framework/fluid-static/eslint.config.mts index 831eb9f65973..73391a7e3ba6 100644 --- a/packages/framework/fluid-static/eslint.config.mts +++ b/packages/framework/fluid-static/eslint.config.mts @@ -3,12 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/oldest-client-observer/eslint.config.mts b/packages/framework/oldest-client-observer/eslint.config.mts index c08def690494..b28d77a87f58 100644 --- a/packages/framework/oldest-client-observer/eslint.config.mts +++ b/packages/framework/oldest-client-observer/eslint.config.mts @@ -3,10 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: "./tsconfig.json", - }, - rules: {}, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/framework/presence/eslint.config.mts b/packages/framework/presence/eslint.config.mts index 35cdb492567e..95299d55f911 100644 --- a/packages/framework/presence/eslint.config.mts +++ b/packages/framework/presence/eslint.config.mts @@ -3,43 +3,51 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.main.json", "./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // The clarity of explicit index signatures is helpful in many places with this package. - "@typescript-eslint/consistent-indexed-object-style": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // The clarity of explicit index signatures is helpful in many places with this package. + "@typescript-eslint/consistent-indexed-object-style": "off", - // TODO: Reenable no-explicit-any once need with ValueDirectoryOrState is - // understood. If `any` is still needed disable is on a per line basis. - "@typescript-eslint/no-explicit-any": "off", - "import-x/no-internal-modules": [ - "error", - { - "allow": [ - "@fluidframework/*/internal{,/**}", - "*/index.js", - "@fluidframework/presence/alpha", - "@fluidframework/presence/beta", - ], - }, - ], + // TODO: Reenable no-explicit-any once need with ValueDirectoryOrState is + // understood. If `any` is still needed disable is on a per line basis. + "@typescript-eslint/no-explicit-any": "off", + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "@fluidframework/*/internal{,/**}", + "*/index.js", + "@fluidframework/presence/alpha", + "@fluidframework/presence/beta", + ], + }, + ], + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - "@typescript-eslint/no-explicit-any": "error", - // TODO: There are several violations, mostly in test code. Set to warn to enable cleanup while unblocking lint upgrades. - "@fluid-internal/fluid/no-unchecked-record-access": "warn", + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + "@typescript-eslint/no-explicit-any": "error", - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert"] }], - }, + // TODO: There are several violations, mostly in test code. Set to warn to enable cleanup while unblocking lint upgrades. + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/framework/react/eslint.config.mts b/packages/framework/react/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/framework/react/eslint.config.mts +++ b/packages/framework/react/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/framework/request-handler/eslint.config.mts b/packages/framework/request-handler/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/framework/request-handler/eslint.config.mts +++ b/packages/framework/request-handler/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/framework/synthesize/eslint.config.mts b/packages/framework/synthesize/eslint.config.mts index 910298ab5855..012ae5a3d553 100644 --- a/packages/framework/synthesize/eslint.config.mts +++ b/packages/framework/synthesize/eslint.config.mts @@ -3,14 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/framework/tree-agent-langchain/eslint.config.mts b/packages/framework/tree-agent-langchain/eslint.config.mts index ae87bffc7d6f..059925aedb3a 100644 --- a/packages/framework/tree-agent-langchain/eslint.config.mts +++ b/packages/framework/tree-agent-langchain/eslint.config.mts @@ -3,54 +3,53 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], + }, }, - overrides: [ - { - files: ["src/test/**/*"], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - rules: { - // Test files can import from submodules for testing purposes - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "*/index.js", - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], - // Allow unresolved for intentionally reaching into alpha/internal of other packages during integration tests - "import-x/no-unresolved": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - }, + { + files: ["src/test/**/*"], + rules: { + // Test files can import from submodules for testing purposes + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "*/index.js", + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], + // Allow unresolved for intentionally reaching into alpha/internal of other packages during integration tests + "import-x/no-unresolved": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/strict-boolean-expressions": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/framework/tree-agent-ses/eslint.config.mts b/packages/framework/tree-agent-ses/eslint.config.mts index 174052781779..de30cae1a022 100644 --- a/packages/framework/tree-agent-ses/eslint.config.mts +++ b/packages/framework/tree-agent-ses/eslint.config.mts @@ -3,52 +3,52 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], + }, }, - overrides: [ - { - files: ["src/test/**/*"], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "*/index.js", - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], - "import-x/no-unresolved": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - }, + { + files: ["src/test/**/*"], + rules: { + // Test files can import from submodules for testing purposes + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "*/index.js", + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], + "import-x/no-unresolved": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/strict-boolean-expressions": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/framework/tree-agent/eslint.config.mts b/packages/framework/tree-agent/eslint.config.mts index 23b6967288bb..32940fbc0b7f 100644 --- a/packages/framework/tree-agent/eslint.config.mts +++ b/packages/framework/tree-agent/eslint.config.mts @@ -3,46 +3,45 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], + }, }, - overrides: [ - { - files: ["src/test/**/*"], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - rules: { - // Test files can import from submodules for testing purposes - "import-x/no-internal-modules": [ - "error", - { - allow: [ - "*/index.js", - "@fluidframework/*/alpha", - "@fluidframework/*/beta", - "@fluidframework/*/legacy", - "@fluidframework/*/internal", - ], - }, - ], - }, + { + files: ["src/test/**/*"], + rules: { + // Test files can import from submodules for testing purposes + "import-x/no-internal-modules": [ + "error", + { + allow: [ + "*/index.js", + "@fluidframework/*/alpha", + "@fluidframework/*/beta", + "@fluidframework/*/legacy", + "@fluidframework/*/internal", + ], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/framework/undo-redo/eslint.config.mts b/packages/framework/undo-redo/eslint.config.mts index 817c2d2013b7..64499c69a16f 100644 --- a/packages/framework/undo-redo/eslint.config.mts +++ b/packages/framework/undo-redo/eslint.config.mts @@ -3,25 +3,32 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/no-use-before-define": "off", - "no-case-declarations": "off", +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/no-use-before-define": "off", + "no-case-declarations": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert"] }], - }, + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/loader/container-loader/eslint.config.mts b/packages/loader/container-loader/eslint.config.mts index 285b370b3229..c338cf8a771f 100644 --- a/packages/loader/container-loader/eslint.config.mts +++ b/packages/loader/container-loader/eslint.config.mts @@ -3,22 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert"] }], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/loader/driver-utils/eslint.config.mts b/packages/loader/driver-utils/eslint.config.mts index 80c49b2ac1a3..93472627203f 100644 --- a/packages/loader/driver-utils/eslint.config.mts +++ b/packages/loader/driver-utils/eslint.config.mts @@ -3,28 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": ["error"], - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "import-x/no-nodejs-modules": ["error"], + "@fluid-internal/fluid/no-unchecked-record-access": "warn", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - "import-x/no-nodejs-modules": "off", // Node libraries are OK for test files. - }, + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Node libraries are OK for test files. + "import-x/no-nodejs-modules": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/loader/test-loader-utils/eslint.config.mts b/packages/loader/test-loader-utils/eslint.config.mts index 1fb8c1dd1943..b28d77a87f58 100644 --- a/packages/loader/test-loader-utils/eslint.config.mts +++ b/packages/loader/test-loader-utils/eslint.config.mts @@ -3,6 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/recommended", "prettier"], -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/runtime/container-runtime-definitions/eslint.config.mts b/packages/runtime/container-runtime-definitions/eslint.config.mts index 7fe827c3ab93..863f297b7ac3 100644 --- a/packages/runtime/container-runtime-definitions/eslint.config.mts +++ b/packages/runtime/container-runtime-definitions/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/strict", "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/runtime/container-runtime/eslint.config.mts b/packages/runtime/container-runtime/eslint.config.mts index 71a9a663e8cc..c86ddf304b73 100644 --- a/packages/runtime/container-runtime/eslint.config.mts +++ b/packages/runtime/container-runtime/eslint.config.mts @@ -3,28 +3,36 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // AB#51780: temporarily disabled because of crashes in typescript-eslint on destructuring in promise chains. - // See: channelCollection.ts:1070 - "@typescript-eslint/unbound-method": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // AB#51780: temporarily disabled because of crashes in typescript-eslint on destructuring in promise chains. + // See: channelCollection.ts:1070 + "@typescript-eslint/unbound-method": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/explicit-function-return-type": "off", - "unicorn/consistent-function-scoping": "off", - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["node:assert", "node:crypto"] }], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/explicit-function-return-type": "off", + "unicorn/consistent-function-scoping": "off", + + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:crypto"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/runtime/datastore-definitions/eslint.config.mts b/packages/runtime/datastore-definitions/eslint.config.mts index 7fe827c3ab93..863f297b7ac3 100644 --- a/packages/runtime/datastore-definitions/eslint.config.mts +++ b/packages/runtime/datastore-definitions/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/strict", "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/runtime/datastore/eslint.config.mts b/packages/runtime/datastore/eslint.config.mts index be748a475e8b..b28d77a87f58 100644 --- a/packages/runtime/datastore/eslint.config.mts +++ b/packages/runtime/datastore/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...recommended]; + +export default config; diff --git a/packages/runtime/id-compressor/eslint.config.mts b/packages/runtime/id-compressor/eslint.config.mts index fadd6987e6ce..205d1e381683 100644 --- a/packages/runtime/id-compressor/eslint.config.mts +++ b/packages/runtime/id-compressor/eslint.config.mts @@ -3,25 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/recommended"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**/*.ts"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": [ - "error", - { allow: ["node:assert", "node:crypto", "node:fs", "node:path"] }, - ], - }, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**/*.ts"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["node:assert", "node:crypto", "node:fs", "node:path"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/runtime/runtime-definitions/eslint.config.mts b/packages/runtime/runtime-definitions/eslint.config.mts index 75ec9bda5803..d45e8fc6843f 100644 --- a/packages/runtime/runtime-definitions/eslint.config.mts +++ b/packages/runtime/runtime-definitions/eslint.config.mts @@ -3,9 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + ignores: ["test-d"], }, - extends: ["@fluidframework/eslint-config-fluid", "prettier"], -}; +]; + +export default config; diff --git a/packages/runtime/runtime-utils/eslint.config.mts b/packages/runtime/runtime-utils/eslint.config.mts index b3e5dfc66bd2..252cea1b98ad 100644 --- a/packages/runtime/runtime-utils/eslint.config.mts +++ b/packages/runtime/runtime-utils/eslint.config.mts @@ -3,12 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/packages/runtime/test-runtime-utils/eslint.config.mts b/packages/runtime/test-runtime-utils/eslint.config.mts index 7d3c2a8eaaf9..ba19730c3a7b 100644 --- a/packages/runtime/test-runtime-utils/eslint.config.mts +++ b/packages/runtime/test-runtime-utils/eslint.config.mts @@ -3,30 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", + }, }, - overrides: [ - { - // The assertion shortcode map file is auto-generated, so disable some rules. - files: ["src/assertionShortCodesMap.ts"], - rules: { - "@typescript-eslint/comma-dangle": "off", - }, + // The assertion shortcode map file is auto-generated, so disable some rules. + { + files: ["src/assertionShortCodesMap.ts"], + rules: { + "@typescript-eslint/comma-dangle": "off", }, - { - files: ["src/test/**"], - rules: { - "import-x/no-nodejs-modules": "off", - }, + }, + { + files: ["src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/service-clients/azure-client/eslint.config.mts b/packages/service-clients/azure-client/eslint.config.mts index 690bb76fa6d7..81fd4448ba14 100644 --- a/packages/service-clients/azure-client/eslint.config.mts +++ b/packages/service-clients/azure-client/eslint.config.mts @@ -3,48 +3,52 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // Useful for developer accessibility - "unicorn/prevent-abbreviations": [ - "error", - { - // Exact variable name checks. - // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#allowlist - allowList: { - // Industry-standard index variable name. - i: true, - }, +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Useful for developer accessibility + "unicorn/prevent-abbreviations": [ + "error", + { + // Exact variable name checks. + // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#allowlist + allowList: { + // Industry-standard index variable name. + i: true, + }, - // RegEx-based exclusions - // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#ignore - ignore: [ - // "props" has become something of an industry standard abbreviation for "properties". - // Allow names to include "props" / "Props". - "[pP]rops", - ], - }, - ], + // RegEx-based exclusions + // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#ignore + ignore: [ + // "props" has become something of an industry standard abbreviation for "properties". + // Allow names to include "props" / "Props". + "[pP]rops", + ], + }, + ], + }, }, - overrides: [ - { - // Overrides for type-tests - files: ["src/test/types/*"], - rules: { - "unicorn/prevent-abbreviations": "off", - }, + + // Overrides for type-tests + { + files: ["src/test/types/*"], + rules: { + "unicorn/prevent-abbreviations": "off", }, - { - // Overrides for tests - files: ["src/test/*.spec.ts"], - rules: { - // Mocha tests should prefer regular functions, see https://mochajs.org/#arrow-functions - "prefer-arrow-callback": "off", - }, + }, + + // Overrides for tests + { + files: ["src/test/*.spec.ts"], + rules: { + // Mocha tests should prefer regular functions, see https://mochajs.org/#arrow-functions + "prefer-arrow-callback": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/service-clients/end-to-end-tests/azure-client/eslint.config.mts b/packages/service-clients/end-to-end-tests/azure-client/eslint.config.mts index b86218175b77..ea617d17671d 100644 --- a/packages/service-clients/end-to-end-tests/azure-client/eslint.config.mts +++ b/packages/service-clients/end-to-end-tests/azure-client/eslint.config.mts @@ -3,6 +3,9 @@ * Licensed under the MIT License. */ +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; + const importInternalModulesAllowedForTest = [ // Allow import of Fluid Framework external API exports. "@fluidframework/*/{beta,alpha,legacy}", @@ -24,41 +27,64 @@ const importInternalModulesAllowedForTest = [ "@fluidframework/test-runtime-utils/internal", ]; -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - rules: { - "prefer-arrow-callback": "off", - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "prefer-arrow-callback": "off", + // requires strictNullChecks=true in tsconfig + "@typescript-eslint/strict-boolean-expressions": "off", - // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. - "@typescript-eslint/consistent-type-exports": [ - "error", - { fixMixedExportsWithInlineTypeSpecifier: true }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-import-type-side-effects": "error", - // #endregion + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + }, + ], + "@typescript-eslint/no-import-type-side-effects": "error", + // #endregion + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "*.test.ts", "**/test/**"], - rules: { - // Some deprecated APIs are permissible in tests; use `warn` to keep them visible - "import-x/no-deprecated": "warn", - "import-x/no-internal-modules": [ - "error", - { - allow: importInternalModulesAllowedForTest, - }, - ], + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + "@typescript-eslint/consistent-type-exports": [ + "error", + { + fixMixedExportsWithInlineTypeSpecifier: true, + }, + ], + }, + }, + + // Rules only for test files + { + files: ["*.spec.ts", "*.test.ts", "**/test/**"], + rules: { + // Some deprecated APIs are permissible in tests; use `warn` to keep them visible + "import-x/no-deprecated": "warn", + "import-x/no-internal-modules": [ + "error", + { + allow: importInternalModulesAllowedForTest, + }, + ], + }, + }, + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This is a test-only package without a root tsconfig.json, so typescript-eslint's + // projectService can't auto-discover the project configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./src/test/tsconfig.json"], }, }, - ], - parserOptions: { - project: ["./src/test/tsconfig.json"], }, -}; +]; + +export default config; diff --git a/packages/service-clients/end-to-end-tests/odsp-client/eslint.config.mts b/packages/service-clients/end-to-end-tests/odsp-client/eslint.config.mts index a5b75f90c45e..4d0e96bbcff5 100644 --- a/packages/service-clients/end-to-end-tests/odsp-client/eslint.config.mts +++ b/packages/service-clients/end-to-end-tests/odsp-client/eslint.config.mts @@ -3,26 +3,52 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - rules: { - "prefer-arrow-callback": "off", - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig - "import-x/namespace": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../../common/build/eslint-config-fluid/flat.mts"; - // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. - "@typescript-eslint/consistent-type-exports": [ - "error", - { fixMixedExportsWithInlineTypeSpecifier: true }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-import-type-side-effects": "error", - // #endregion +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + "prefer-arrow-callback": "off", + "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig + "import-x/namespace": "off", + + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + }, + ], + "@typescript-eslint/no-import-type-side-effects": "error", + // #endregion + }, + }, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + "@typescript-eslint/consistent-type-exports": [ + "error", + { + fixMixedExportsWithInlineTypeSpecifier: true, + }, + ], + }, }, - parserOptions: { - project: ["./src/test/tsconfig.json"], + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This is a test-only package without a root tsconfig.json, so typescript-eslint's + // projectService can't auto-discover the project configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./src/test/tsconfig.json"], + }, + }, }, -}; +]; + +export default config; diff --git a/packages/service-clients/odsp-client/eslint.config.mts b/packages/service-clients/odsp-client/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/service-clients/odsp-client/eslint.config.mts +++ b/packages/service-clients/odsp-client/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/service-clients/tinylicious-client/eslint.config.mts b/packages/service-clients/tinylicious-client/eslint.config.mts index a01a3a07c3b2..d1cb32349162 100644 --- a/packages/service-clients/tinylicious-client/eslint.config.mts +++ b/packages/service-clients/tinylicious-client/eslint.config.mts @@ -3,19 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - overrides: [ - { - // Overrides for tests - files: ["src/test/*.spec.ts"], - rules: { - // Mocha tests should prefer regular functions, see https://mochajs.org/#arrow-functions - "prefer-arrow-callback": "off", - }, +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + // Overrides for tests + { + files: ["src/test/*.spec.ts"], + rules: { + // Mocha tests should prefer regular functions, see https://mochajs.org/#arrow-functions + "prefer-arrow-callback": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/test/functional-tests/eslint.config.mts b/packages/test/functional-tests/eslint.config.mts index a100b26bb28e..db16ac3b8c39 100644 --- a/packages/test/functional-tests/eslint.config.mts +++ b/packages/test/functional-tests/eslint.config.mts @@ -3,19 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - ], -}; + }, +]; + +export default config; diff --git a/packages/test/local-server-stress-tests/eslint.config.mts b/packages/test/local-server-stress-tests/eslint.config.mts index 783dc69e5085..2a8deac93071 100644 --- a/packages/test/local-server-stress-tests/eslint.config.mts +++ b/packages/test/local-server-stress-tests/eslint.config.mts @@ -3,15 +3,30 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + // This package is test-only and only has src/tsconfig.json (no root tsconfig.json). + // Override the base config's parserOptions to only use the test tsconfig. + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This is a test-only package without a root tsconfig.json, so typescript-eslint's + // projectService can't auto-discover the project configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./src/tsconfig.json"], + }, + }, }, - parserOptions: { - project: ["./src/tsconfig.json"], + { + rules: { + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/local-server-tests/eslint.config.mts b/packages/test/local-server-tests/eslint.config.mts index b669157f8e27..3b222b989637 100644 --- a/packages/test/local-server-tests/eslint.config.mts +++ b/packages/test/local-server-tests/eslint.config.mts @@ -3,24 +3,37 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig - "import-x/no-nodejs-modules": "off", - "import-x/no-extraneous-dependencies": [ - "error", - { - // This package is only used to run its tests. It's ok for the src/utils.ts to import from devDependencies, in - // addition to the test files - devDependencies: ["src/utils.ts", "src/test/**"], - }, - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig + "import-x/no-nodejs-modules": "off", + "import-x/no-extraneous-dependencies": [ + "error", + { + // This package is only used to run its tests. It's ok for the src/utils.ts to import from devDependencies, in + // addition to the test files + devDependencies: ["src/utils.ts", "src/test/**"], + }, + ], + }, }, - parserOptions: { - project: ["./src/test/tsconfig.json"], + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This is a test-only package without a root tsconfig.json, so typescript-eslint's + // projectService can't auto-discover the project configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./src/test/tsconfig.json"], + }, + }, }, -}; +]; + +export default config; diff --git a/packages/test/mocha-test-setup/eslint.config.mts b/packages/test/mocha-test-setup/eslint.config.mts index fd46f852c0e4..cb5255b96738 100644 --- a/packages/test/mocha-test-setup/eslint.config.mts +++ b/packages/test/mocha-test-setup/eslint.config.mts @@ -3,6 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/minimal-deprecated", "prettier"], -}; +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...minimalDeprecated]; + +export default config; diff --git a/packages/test/snapshots/eslint.config.mts b/packages/test/snapshots/eslint.config.mts index 181a344f49d1..7d89ca0b4700 100644 --- a/packages/test/snapshots/eslint.config.mts +++ b/packages/test/snapshots/eslint.config.mts @@ -3,17 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/stochastic-test-utils/eslint.config.mts b/packages/test/stochastic-test-utils/eslint.config.mts index ccc93ccf7f59..4b7ff101888d 100644 --- a/packages/test/stochastic-test-utils/eslint.config.mts +++ b/packages/test/stochastic-test-utils/eslint.config.mts @@ -3,16 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/test-driver-definitions/eslint.config.mts b/packages/test/test-driver-definitions/eslint.config.mts index f58a1e01f543..d610c5bd6ff5 100644 --- a/packages/test/test-driver-definitions/eslint.config.mts +++ b/packages/test/test-driver-definitions/eslint.config.mts @@ -3,16 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + // Rules only for test files + files: ["*.spec.ts", "src/test/**"], + rules: {}, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: {}, - }, - ], -}; +]; + +export default config; diff --git a/packages/test/test-drivers/eslint.config.mts b/packages/test/test-drivers/eslint.config.mts index d9f312e6c14c..93a6326da592 100644 --- a/packages/test/test-drivers/eslint.config.mts +++ b/packages/test/test-drivers/eslint.config.mts @@ -3,18 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "import-x/no-nodejs-modules": "off", - // Disabled because the rule is crashing on this package - AB#51780 - "@typescript-eslint/unbound-method": "off", + // Disabled because the rule is crashing on this package - AB#51780 + "@typescript-eslint/unbound-method": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/test-end-to-end-tests/eslint.config.mts b/packages/test/test-end-to-end-tests/eslint.config.mts index 81d3053c0f91..cd73df386487 100644 --- a/packages/test/test-end-to-end-tests/eslint.config.mts +++ b/packages/test/test-end-to-end-tests/eslint.config.mts @@ -3,52 +3,106 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./src/test/tsconfig.json"], - }, - rules: { - // #region TODO: Fix violations and remove these rule disables - - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; - "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig - - "prefer-arrow-callback": "off", +const config: Linter.Config[] = [ + ...minimalDeprecated, + // This package is test-only and only has src/test/tsconfig.json (no root tsconfig.json). + // Override the base config's parserOptions to only use the test tsconfig. + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This is a test-only package without a root tsconfig.json, so typescript-eslint's + // projectService can't auto-discover the project configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./src/test/tsconfig.json"], + }, + }, + }, + { + rules: { + // #region TODO: Fix violations and remove these rule disables - // #endregion + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig + "prefer-arrow-callback": "off", - // This library is used in the browser, so we don't want dependencies on most node libraries. - "import-x/no-nodejs-modules": ["error"], - "@typescript-eslint/no-restricted-imports": [ - "error", - { - paths: [ - "@fluidframework/cell", - "@fluidframework/counter", - "@fluidframework/map", - "@fluidframework/matrix", - "@fluidframework/ordered-collection", - "@fluidframework/register-collection", - "@fluidframework/sequence", - "@fluid-experimental/sequence-deprecated", - "@fluidframework/aqueduct", - "@fluidframework/datastore", - ].map((importName) => ({ - name: importName, - message: - "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", - allowTypeImports: true, - })), - }, - ], + // #endregion - /* + // This library is used in the browser, so we don't want dependencies on most node libraries. + "import-x/no-nodejs-modules": ["error"], + "@typescript-eslint/no-restricted-imports": [ + "error", + { + paths: [ + { + name: "@fluidframework/cell", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/counter", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/map", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/matrix", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/ordered-collection", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/register-collection", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/sequence", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluid-experimental/sequence-deprecated", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/aqueduct", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + { + name: "@fluidframework/datastore", + message: + "Rather than import this Fluid package directly, use the 'apis' argument of describeCompat. See \"How-to\" in the README for more information.", + allowTypeImports: true, + }, + ], + }, + ], + /* This rule causes the following errors, so is temporarily disabled. @fluid-private/test-end-to-end-tests: Error: Circularity detected while resolving configuration: /home/tylerbu/code/release-1/common/build/build-common/tsconfig.base.json @@ -65,25 +119,32 @@ module.exports = { @fluid-private/test-end-to-end-tests: at ExportMap.for (/home/tylerbu/code/release-1/node_modules/.pnpm/eslint-plugin-i@2.29.0_j7h7oj6rrhtikhzta4fgkou42e/node_modules/eslint-plugin-i/lib/ExportMap.js:798:201) @fluid-private/test-end-to-end-tests: at ExportMap.get (/home/tylerbu/code/release-1/node_modules/.pnpm/eslint-plugin-i@2.29.0_j7h7oj6rrhtikhzta4fgkou42e/node_modules/eslint-plugin-i/lib/ExportMap.js:792:465) */ - "import-x/no-deprecated": "off", + "import-x/no-deprecated": "off", + }, }, - overrides: [ - { - // Rules only for test files - files: ["*.spec.ts", "src/test/**"], - rules: { - // Test files are run in node only so additional node libraries can be used. - "import-x/no-nodejs-modules": ["error", { allow: ["assert"] }], - }, + + // Rules only for test files + { + files: ["*.spec.ts", "src/test/**"], + rules: { + // Test files are run in node only so additional node libraries can be used. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["assert"], + }, + ], }, - { - files: ["src/test/benchmark/**"], - rules: { - // General guidance to avoid importing compat-provided APIs does not apply to the benchmark tests, - // since they don't currently aim to test performance of mixed-versioned packages or cross-client - // collaboration between clients. - "@typescript-eslint/no-restricted-imports": "off", - }, + }, + { + files: ["src/test/benchmark/**"], + rules: { + // General guidance to avoid importing compat-provided APIs does not apply to the benchmark tests, + // since they don't currently aim to test performance of mixed-versioned packages or cross-client + // collaboration between clients. + "@typescript-eslint/no-restricted-imports": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/test/test-pairwise-generator/eslint.config.mts b/packages/test/test-pairwise-generator/eslint.config.mts index 6dba3d131b9f..e6e1669631eb 100644 --- a/packages/test/test-pairwise-generator/eslint.config.mts +++ b/packages/test/test-pairwise-generator/eslint.config.mts @@ -3,9 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: ["@fluidframework/eslint-config-fluid/minimal-deprecated", "prettier"], - rules: { - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "warn", + }, }, -}; +]; + +export default config; diff --git a/packages/test/test-service-load/eslint.config.mts b/packages/test/test-service-load/eslint.config.mts index 04629e99e64c..a08a3aeaa134 100644 --- a/packages/test/test-service-load/eslint.config.mts +++ b/packages/test/test-service-load/eslint.config.mts @@ -3,15 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/test-utils/eslint.config.mts b/packages/test/test-utils/eslint.config.mts index 04629e99e64c..a08a3aeaa134 100644 --- a/packages/test/test-utils/eslint.config.mts +++ b/packages/test/test-utils/eslint.config.mts @@ -3,15 +3,16 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/test/test-version-utils/eslint.config.mts b/packages/test/test-version-utils/eslint.config.mts index 097f6031af7f..f4c65b78b871 100644 --- a/packages/test/test-version-utils/eslint.config.mts +++ b/packages/test/test-version-utils/eslint.config.mts @@ -3,17 +3,18 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig - "import-x/no-deprecated": "off", // This package tests deprecated DDSes like SparseMatrix - "import-x/no-nodejs-modules": "off", - }, - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/strict-boolean-expressions": "off", // requires strictNullChecks=true in tsconfig + "import-x/no-deprecated": "off", // This package tests deprecated DDSes like SparseMatrix + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/tools/changelog-generator-wrapper/eslint.config.mts b/packages/tools/changelog-generator-wrapper/eslint.config.mts index 09d32f3a88ce..079241bf838c 100644 --- a/packages/tools/changelog-generator-wrapper/eslint.config.mts +++ b/packages/tools/changelog-generator-wrapper/eslint.config.mts @@ -3,22 +3,21 @@ * Licensed under the MIT License. */ -module.exports = { - plugins: ["@typescript-eslint"], - extends: [ - // eslint-disable-next-line node/no-extraneous-require - require.resolve("@fluidframework/eslint-config-fluid"), - "prettier", - ], - parserOptions: { - project: "./tsconfig.lint.json", - }, - rules: { - // TODO: this package should really extend some base JS config, and not pull in TS-specific rules. - // For now, TS rules are disabled below. - "@typescript-eslint/no-require-imports": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "unicorn/prefer-module": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: this package should really extend some base JS config, and not pull in TS-specific rules. + // For now, TS rules are disabled below. + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "unicorn/prefer-module": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/tools/devtools/devtools-browser-extension/eslint.config.mts b/packages/tools/devtools/devtools-browser-extension/eslint.config.mts index 48f0e9c35625..92bebe57ed6c 100644 --- a/packages/tools/devtools/devtools-browser-extension/eslint.config.mts +++ b/packages/tools/devtools/devtools-browser-extension/eslint.config.mts @@ -3,43 +3,43 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Disabled because they disagrees with React common patterns / best practices. - "@typescript-eslint/unbound-method": "off", - "unicorn/consistent-function-scoping": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Disabled because they disagrees with React common patterns / best practices. + "@typescript-eslint/unbound-method": "off", + "unicorn/consistent-function-scoping": "off", - // Disabled because it conflicts with Prettier. - "unicorn/no-nested-ternary": "off", + // Disabled because it conflicts with Prettier. + "unicorn/no-nested-ternary": "off", - // Prevent imports from undeclared dependencies / dev dependencies, but allow imports from - // dev dependencies in test code. - // TODO: Remove this override once the base config is more flexible around where test code - // lives in a package. - "import-x/no-extraneous-dependencies": [ - "error", - { - devDependencies: ["src/**/test/**"], - }, - ], + // Prevent imports from undeclared dependencies / dev dependencies, but allow imports from + // dev dependencies in test code. + // TODO: Remove this override once the base config is more flexible around where test code + // lives in a package. + "import-x/no-extraneous-dependencies": [ + "error", + { + devDependencies: ["src/**/test/**"], + }, + ], + }, }, - overrides: [ - { - // Overrides for test files - files: ["*.test.ts", "src/test/**"], - plugins: ["chai-expect"], - extends: ["plugin:chai-expect/recommended"], - rules: { - "import-x/no-nodejs-modules": "off", - // "unicorn/prefer-module": "off", - // Superceded by chai-expect rule - "@typescript-eslint/no-unused-expressions": "off", - }, + // Overrides for test files + { + files: ["*.test.ts", "src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + + // Superceded by chai-expect rule + "@typescript-eslint/no-unused-expressions": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/tools/devtools/devtools-core/eslint.config.mts b/packages/tools/devtools/devtools-core/eslint.config.mts index 225d9ee1e3e7..953a3091a2fb 100644 --- a/packages/tools/devtools/devtools-core/eslint.config.mts +++ b/packages/tools/devtools/devtools-core/eslint.config.mts @@ -3,31 +3,32 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // Disabled because they conflict with Prettier. - "unicorn/no-nested-ternary": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Disabled because they conflict with Prettier. + "unicorn/no-nested-ternary": "off", - // Disabled because it is incompatible with API-Extractor. - "@typescript-eslint/no-namespace": "off", + // Disabled because it is incompatible with API-Extractor. + "@typescript-eslint/no-namespace": "off", + }, }, - overrides: [ - { - // Overrides for test files - files: ["src/test/**"], - plugins: ["chai-expect"], - extends: ["plugin:chai-expect/recommended"], - rules: { - "import-x/no-nodejs-modules": "off", - "unicorn/prefer-module": "off", - // Superseded by chai-expect rule - "@typescript-eslint/no-unused-expressions": "off", - }, + // Overrides for test files + { + files: ["src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + "unicorn/prefer-module": "off", + + // Superseded by chai-expect rule + "@typescript-eslint/no-unused-expressions": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/tools/devtools/devtools-test-app/eslint.config.mts b/packages/tools/devtools/devtools-test-app/eslint.config.mts index 1bf41239a51a..d45a7fcd4d8e 100644 --- a/packages/tools/devtools/devtools-test-app/eslint.config.mts +++ b/packages/tools/devtools/devtools-test-app/eslint.config.mts @@ -3,53 +3,47 @@ * Licensed under the MIT License. */ -module.exports = { - plugins: ["react", "react-hooks"], - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/strict"), - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Disabled because they disagrees with React common patterns / best practices. - "@typescript-eslint/unbound-method": "off", - "unicorn/consistent-function-scoping": "off", - - // Disabled because they conflict with Prettier. - "unicorn/no-nested-ternary": "off", - "import-x/no-extraneous-dependencies": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; - // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() - // with the new React 18 createRoot(). - "react/no-deprecated": "off", +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Disabled because they disagrees with React common patterns / best practices. + "@typescript-eslint/unbound-method": "off", + "unicorn/consistent-function-scoping": "off", - // TODO: These rules should be re-enabled once we are on eslint 9 - // and the react plugins are upgraded to more recent versions - "react-hooks/immutability": "warn", - "react-hooks/refs": "warn", - "react-hooks/rules-of-hooks": "warn", - "react-hooks/set-state-in-effect": "warn", - "react-hooks/static-components": "warn", + // Disabled because they conflict with Prettier. + "unicorn/no-nested-ternary": "off", + "import-x/no-extraneous-dependencies": "off", + }, }, - overrides: [ - { - // Overrides for test files - files: ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/test/**"], - plugins: ["jest"], - extends: ["plugin:jest/recommended"], - rules: { - "import-x/no-nodejs-modules": "off", - "unicorn/prefer-module": "off", - }, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: AB#18875 - Re-enable react/no-deprecated once we replace uses of the deprecated ReactDOM.render() + // with the new React 18 createRoot(). + "react/no-deprecated": "off", + + // TODO: These rules should be re-enabled once we are on eslint 9 + // and the react plugins are upgraded to more recent versions + "react-hooks/immutability": "warn", + "react-hooks/refs": "warn", + "react-hooks/rules-of-hooks": "warn", + "react-hooks/set-state-in-effect": "warn", + "react-hooks/static-components": "warn", }, - ], - settings: { - react: { - version: "detect", + }, + + // Overrides for test files + { + files: ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + "unicorn/prefer-module": "off", }, }, -}; +]; + +export default config; diff --git a/packages/tools/devtools/devtools-view/eslint.config.mts b/packages/tools/devtools/devtools-view/eslint.config.mts index 06fafe0cad60..ba39ac67e6e7 100644 --- a/packages/tools/devtools/devtools-view/eslint.config.mts +++ b/packages/tools/devtools/devtools-view/eslint.config.mts @@ -3,79 +3,86 @@ * Licensed under the MIT License. */ -module.exports = { - plugins: ["react", "react-hooks"], - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/strict"), - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "prettier", - ], - parserOptions: { - project: ["./tsconfig.esm.json", "./src/test/tsconfig.esm.json"], - }, - rules: { - // Disabled because they disagrees with React common patterns / best practices. - "@typescript-eslint/unbound-method": "off", - "unicorn/consistent-function-scoping": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; - // Disabled because they conflict with Prettier. - "unicorn/no-nested-ternary": "off", +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Disabled because they disagrees with React common patterns / best practices. + "@typescript-eslint/unbound-method": "off", + "unicorn/consistent-function-scoping": "off", - /** - * TODO: remove this override once dependency on base config has been updated - * (newer versions will have this rule disabled). - */ - "unicorn/no-useless-undefined": "off", + // Disabled because they conflict with Prettier. + "unicorn/no-nested-ternary": "off", - // Forbid new imports from legacy FluentUI react package. - // We have a couple of components that still use it, but new usages should not be added without due consideration. - "no-restricted-imports": ["error", "@fluentui/react"], + /** + * TODO: remove this override once dependency on base config has been updated + * (newer versions will have this rule disabled). + */ + "unicorn/no-useless-undefined": "off", - // Allow unassigned imports for testing-library/jest-dom - "import-x/no-unassigned-import": [ - "error", - { - allow: ["@testing-library/jest-dom"], - }, - ], + // Forbid new imports from legacy FluentUI react package. + // We have a couple of components that still use it, but new usages should not be added without due consideration. + "no-restricted-imports": ["error", "@fluentui/react"], - // TODO: These rules should be re-enabled once we are on eslint 9 - // and the react plugins are upgraded to more recent versions - "react-hooks/immutability": "warn", - "react-hooks/refs": "warn", - "react-hooks/rules-of-hooks": "warn", - "react-hooks/set-state-in-effect": "warn", - "react-hooks/static-components": "warn", + // Allow unassigned imports for testing-library/jest-dom + "import-x/no-unassigned-import": [ + "error", + { + allow: ["@testing-library/jest-dom"], + }, + ], + }, }, - overrides: [ - { - // Overrides for jest test files - files: ["src/test/**"], - plugins: ["jest"], - extends: ["plugin:jest/recommended"], - rules: { - "import-x/no-nodejs-modules": "off", - "unicorn/prefer-module": "off", - "import-x/no-internal-modules": "off", - }, + { + files: ["**/*.jsx", "**/*.tsx"], + rules: { + // TODO: These rules should be re-enabled once we are on eslint 9 + // and the react plugins are upgraded to more recent versions + "react-hooks/immutability": "warn", + "react-hooks/refs": "warn", + "react-hooks/rules-of-hooks": "warn", + "react-hooks/set-state-in-effect": "warn", + "react-hooks/static-components": "warn", }, - { - // Overrides for screenshot tests - files: ["src/test/screenshot/**"], - rules: { - // Default exports are used by "Storybook" modules to describe test scenarios - "import-x/no-default-export": "off", + }, - // Fine for tests - "import-x/no-nodejs-modules": "off", - "import-x/no-extraneous-dependencies": "off", - }, + // Overrides for jest test files + { + files: ["src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + "unicorn/prefer-module": "off", + "import-x/no-internal-modules": "off", }, - ], - settings: { - react: { - version: "detect", + }, + + // Overrides for screenshot tests + { + files: ["src/test/screenshot/**"], + rules: { + // Default exports are used by "Storybook" modules to describe test scenarios + "import-x/no-default-export": "off", + + // Fine for tests + "import-x/no-nodejs-modules": "off", + "import-x/no-extraneous-dependencies": "off", + }, + }, + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // Tests use tsconfig.jest.json instead of the standard src/test/tsconfig.json naming, + // so typescript-eslint's projectService can't auto-discover the test configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: ["./tsconfig.esm.json", "./src/test/tsconfig.esm.json"], + }, }, }, -}; +]; + +export default config; diff --git a/packages/tools/devtools/devtools/eslint.config.mts b/packages/tools/devtools/devtools/eslint.config.mts index 53727a47cf88..e8fabfaab863 100644 --- a/packages/tools/devtools/devtools/eslint.config.mts +++ b/packages/tools/devtools/devtools/eslint.config.mts @@ -3,26 +3,29 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], - }, - rules: { - // Disabled because they conflict with Prettier. - "unicorn/no-nested-ternary": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // Disabled because they conflict with Prettier. + "unicorn/no-nested-ternary": "off", - // Disabled because it is incompatible with API-Extractor. - "@typescript-eslint/no-namespace": "off", + // Disabled because it is incompatible with API-Extractor. + "@typescript-eslint/no-namespace": "off", + }, }, - overrides: [ - { - // Overrides for test files - files: ["*.spec.ts", "*.test.ts", "src/test/**"], - rules: { - "import-x/no-nodejs-modules": "off", - "unicorn/prefer-module": "off", - }, + + // Overrides for test files + { + files: ["*.spec.ts", "*.test.ts", "src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + "unicorn/prefer-module": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/packages/tools/fetch-tool/eslint.config.mts b/packages/tools/fetch-tool/eslint.config.mts index f6b3c30030ec..f0aed506fed1 100644 --- a/packages/tools/fetch-tool/eslint.config.mts +++ b/packages/tools/fetch-tool/eslint.config.mts @@ -3,25 +3,47 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - // This library is used in the browser, so we don't want dependencies on most node libraries. - "import-x/no-nodejs-modules": ["error", { allow: ["child_process", "fs", "util"] }], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; - // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. - "@typescript-eslint/consistent-type-exports": [ - "error", - { fixMixedExportsWithInlineTypeSpecifier: true }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-import-type-side-effects": "error", - // #endregion +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + // This library is used in the browser, so we don't want dependencies on most node libraries. + "import-x/no-nodejs-modules": [ + "error", + { + allow: ["child_process", "fs", "util"], + }, + ], + + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + }, + ], + "@typescript-eslint/no-import-type-side-effects": "error", + // #endregion + }, + }, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-exports": [ + "error", + { + fixMixedExportsWithInlineTypeSpecifier: true, + }, + ], + + // #endregion + }, }, -}; +]; + +export default config; diff --git a/packages/tools/fluid-runner/eslint.config.mts b/packages/tools/fluid-runner/eslint.config.mts index 8e7f5fd4ec15..dc6aa7c5d867 100644 --- a/packages/tools/fluid-runner/eslint.config.mts +++ b/packages/tools/fluid-runner/eslint.config.mts @@ -3,45 +3,72 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: [ - "./tsconfig.json", - "./tsconfig.bin.lint.json", - "./src/test/tsconfig.json", - "./src/test/tsconfig.cjs.lint.json", - ], +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "import-x/no-nodejs-modules": "off", + "unicorn/filename-case": [ + "error", + { + cases: { + camelCase: true, + pascalCase: true, + }, + ignore: ["fluid-runner", "sample-executable"], + }, + ], + + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + }, + ], + "@typescript-eslint/no-import-type-side-effects": "error", + // #endregion + }, }, - rules: { - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": "off", - "unicorn/filename-case": [ - "error", - { - cases: { - camelCase: true, - pascalCase: true, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-exports": [ + "error", + { + fixMixedExportsWithInlineTypeSpecifier: true, }, - ignore: ["fluid-runner", "sample-executable"], - }, - ], + ], - // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. - "@typescript-eslint/consistent-type-exports": [ - "error", - { fixMixedExportsWithInlineTypeSpecifier: true }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-import-type-side-effects": "error", - // #endregion + // #endregion + }, + }, + { + // Override @typescript-eslint/parser to use explicit project list instead of projectService. + // This package has special .cjs.ts test files excluded from the main test tsconfig that + // require a separate tsconfig.cjs.lint.json for linting. typescript-eslint's projectService + // can't auto-discover this non-standard configuration. + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], + languageOptions: { + parserOptions: { + projectService: false, + project: [ + "./tsconfig.json", + "./tsconfig.bin.lint.json", + "./src/test/tsconfig.json", + "./src/test/tsconfig.cjs.lint.json", + ], + }, + }, }, -}; +]; + +export default config; diff --git a/packages/tools/replay-tool/eslint.config.mts b/packages/tools/replay-tool/eslint.config.mts index 52028591676a..f0f1d7c3de9e 100644 --- a/packages/tools/replay-tool/eslint.config.mts +++ b/packages/tools/replay-tool/eslint.config.mts @@ -3,28 +3,45 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-deprecated": "off", // This package often uses deprecated APIs because it's used to replay ops from older versions of the runtime - "import-x/no-nodejs-modules": "off", - "no-case-declarations": "off", +import type { Linter } from "eslint"; +import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts"; - // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. - "@typescript-eslint/consistent-type-exports": [ - "error", - { fixMixedExportsWithInlineTypeSpecifier: true }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { fixStyle: "inline-type-imports" }, - ], - "@typescript-eslint/no-import-type-side-effects": "error", - // #endregion +const config: Linter.Config[] = [ + ...minimalDeprecated, + { + rules: { + "@typescript-eslint/prefer-nullish-coalescing": "off", // requires strictNullChecks + "@typescript-eslint/strict-boolean-expressions": "off", + // This package often uses deprecated APIs because it's used to replay ops from older versions of the runtime + "import-x/no-deprecated": "off", + "import-x/no-nodejs-modules": "off", + "no-case-declarations": "off", + + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + }, + ], + "@typescript-eslint/no-import-type-side-effects": "error", + // #endregion + }, + }, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + // #region TODO: remove these once this config has been updated to use our "recommended" base instead of our deprecated minimal one. + "@typescript-eslint/consistent-type-exports": [ + "error", + { + fixMixedExportsWithInlineTypeSpecifier: true, + }, + ], + // #endregion + }, }, -}; +]; + +export default config; diff --git a/packages/utils/odsp-doclib-utils/eslint.config.mts b/packages/utils/odsp-doclib-utils/eslint.config.mts index 2b2ac7e098c6..ff2a5506165f 100644 --- a/packages/utils/odsp-doclib-utils/eslint.config.mts +++ b/packages/utils/odsp-doclib-utils/eslint.config.mts @@ -3,15 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // TODO: remove these overrides and fix violations - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "no-case-declarations": "off", +import type { Linter } from "eslint"; +import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...recommended, + { + rules: { + // TODO: remove these overrides and fix violations + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "no-case-declarations": "off", + }, }, -}; +]; + +export default config; diff --git a/packages/utils/telemetry-utils/eslint.config.mts b/packages/utils/telemetry-utils/eslint.config.mts index f1aaefc67a58..863f297b7ac3 100644 --- a/packages/utils/telemetry-utils/eslint.config.mts +++ b/packages/utils/telemetry-utils/eslint.config.mts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, -}; +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [...strict]; + +export default config; diff --git a/packages/utils/tool-utils/eslint.config.mts b/packages/utils/tool-utils/eslint.config.mts index 630c19b93da3..be85f8faeb7d 100644 --- a/packages/utils/tool-utils/eslint.config.mts +++ b/packages/utils/tool-utils/eslint.config.mts @@ -3,13 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - // This package is intended to be used in node.js environments - "import-x/no-nodejs-modules": "off", +import type { Linter } from "eslint"; +import { strict } from "../../../common/build/eslint-config-fluid/flat.mts"; + +const config: Linter.Config[] = [ + ...strict, + { + rules: { + // This package is intended to be used in node.js environments + "import-x/no-nodejs-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/gitresources/eslint.config.mts b/server/routerlicious/packages/gitresources/eslint.config.mts index 14c90f7e9e00..8273a2f2ac5b 100644 --- a/server/routerlicious/packages/gitresources/eslint.config.mts +++ b/server/routerlicious/packages/gitresources/eslint.config.mts @@ -3,12 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - rules: { - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { recommendedConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +const config: Linter.Config[] = [ + ...recommendedConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/kafka-orderer/eslint.config.mts b/server/routerlicious/packages/kafka-orderer/eslint.config.mts index 868a5aefe63a..588f19d3b574 100644 --- a/server/routerlicious/packages/kafka-orderer/eslint.config.mts +++ b/server/routerlicious/packages/kafka-orderer/eslint.config.mts @@ -3,15 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/lambdas-driver/eslint.config.mts b/server/routerlicious/packages/lambdas-driver/eslint.config.mts index 67e58a7a5aa8..588f19d3b574 100644 --- a/server/routerlicious/packages/lambdas-driver/eslint.config.mts +++ b/server/routerlicious/packages/lambdas-driver/eslint.config.mts @@ -3,23 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/lambdas/eslint.config.mts b/server/routerlicious/packages/lambdas/eslint.config.mts index 2a3d3dc92a4d..119cc39c0351 100644 --- a/server/routerlicious/packages/lambdas/eslint.config.mts +++ b/server/routerlicious/packages/lambdas/eslint.config.mts @@ -3,33 +3,24 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - rules: { - "@rushstack/no-new-null": "off", - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], - "unicorn/no-null": "off", +import type { Linter } from "eslint"; +import { recommendedConfig } from "../../eslint.config.base.mts"; - // TODO: fix violations and remove these overrides - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unsafe-argument": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/restrict-template-expressions": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "unicorn/prefer-node-protocol": "off", - "unicorn/text-encoding-identifier-case": "off", - - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...recommendedConfig, + { + rules: { + // Additional lambdas-specific rules + "@rushstack/no-new-null": "off", + "unicorn/no-null": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "unicorn/prefer-node-protocol": "off", + "unicorn/text-encoding-identifier-case": "off", + }, }, -}; + { + ignores: ["*.generated.ts", "*.spec.ts"], + }, +]; + +export default config; diff --git a/server/routerlicious/packages/local-server/eslint.config.mts b/server/routerlicious/packages/local-server/eslint.config.mts index 770702ff7e0f..9866bcb6e5df 100644 --- a/server/routerlicious/packages/local-server/eslint.config.mts +++ b/server/routerlicious/packages/local-server/eslint.config.mts @@ -3,25 +3,17 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - parserOptions: { - "project": ["./tsconfig.json", "./src/test/tsconfig.json"], - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", - }, - overrides: [ - { - files: ["src/test/**/*.ts"], - rules: { - "import-x/no-nodejs-modules": "off", - }, +const config: Linter.Config[] = [ + ...baseConfig, + { + files: ["src/test/**/*.ts"], + rules: { + "import-x/no-nodejs-modules": "off", }, - ], -}; + }, +]; + +export default config; diff --git a/server/routerlicious/packages/memory-orderer/eslint.config.mts b/server/routerlicious/packages/memory-orderer/eslint.config.mts index 6a67cacc85df..cbf063211fe6 100644 --- a/server/routerlicious/packages/memory-orderer/eslint.config.mts +++ b/server/routerlicious/packages/memory-orderer/eslint.config.mts @@ -3,21 +3,20 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/restrict-template-expressions": "off", - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + rules: { + // Package-specific rules + "@typescript-eslint/restrict-template-expressions": "off", + }, + }, + { + ignores: ["*.spec.ts", "*.generated.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/protocol-base/eslint.config.mts b/server/routerlicious/packages/protocol-base/eslint.config.mts index 432b621bd7d8..478de02b1b8a 100644 --- a/server/routerlicious/packages/protocol-base/eslint.config.mts +++ b/server/routerlicious/packages/protocol-base/eslint.config.mts @@ -3,25 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/no-floating-promises": "off", - "@typescript-eslint/no-use-before-define": "off", - "no-case-declarations": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + rules: { + // Package-specific rules + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-use-before-define": "off", + "no-case-declarations": "off", + }, }, -}; + { + ignores: ["*.spec.ts", "*.generated.ts"], + }, +]; + +export default config; diff --git a/server/routerlicious/packages/routerlicious-base/eslint.config.mts b/server/routerlicious/packages/routerlicious-base/eslint.config.mts index 72773fecc5f3..588f19d3b574 100644 --- a/server/routerlicious/packages/routerlicious-base/eslint.config.mts +++ b/server/routerlicious/packages/routerlicious-base/eslint.config.mts @@ -3,23 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/routerlicious/eslint.config.mts b/server/routerlicious/packages/routerlicious/eslint.config.mts index 92d489acfbea..ac644d0b5b6a 100644 --- a/server/routerlicious/packages/routerlicious/eslint.config.mts +++ b/server/routerlicious/packages/routerlicious/eslint.config.mts @@ -3,17 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts", "*.generated.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-client/eslint.config.mts b/server/routerlicious/packages/services-client/eslint.config.mts index 4f082866bb77..588f19d3b574 100644 --- a/server/routerlicious/packages/services-client/eslint.config.mts +++ b/server/routerlicious/packages/services-client/eslint.config.mts @@ -3,26 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-core/eslint.config.mts b/server/routerlicious/packages/services-core/eslint.config.mts index 67e58a7a5aa8..588f19d3b574 100644 --- a/server/routerlicious/packages/services-core/eslint.config.mts +++ b/server/routerlicious/packages/services-core/eslint.config.mts @@ -3,23 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-ordering-kafkanode/eslint.config.mts b/server/routerlicious/packages/services-ordering-kafkanode/eslint.config.mts index 7245bd4e550b..588f19d3b574 100644 --- a/server/routerlicious/packages/services-ordering-kafkanode/eslint.config.mts +++ b/server/routerlicious/packages/services-ordering-kafkanode/eslint.config.mts @@ -3,19 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - // This package uses node's events APIs. - // This should probably be reconsidered, but until then we will leave an exception for it here. - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-ordering-rdkafka/eslint.config.mts b/server/routerlicious/packages/services-ordering-rdkafka/eslint.config.mts index b3cde90d9938..588f19d3b574 100644 --- a/server/routerlicious/packages/services-ordering-rdkafka/eslint.config.mts +++ b/server/routerlicious/packages/services-ordering-rdkafka/eslint.config.mts @@ -3,23 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - "import-x/no-nodejs-modules": "off", - - // TODO: re-enable once eslint is v9+ and @typescript-eslint is upgraded accordingly - "@typescript-eslint/no-unsafe-return": "off", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-ordering-zookeeper/eslint.config.mts b/server/routerlicious/packages/services-ordering-zookeeper/eslint.config.mts index 5b9d471736ed..588f19d3b574 100644 --- a/server/routerlicious/packages/services-ordering-zookeeper/eslint.config.mts +++ b/server/routerlicious/packages/services-ordering-zookeeper/eslint.config.mts @@ -3,16 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/strict-boolean-expressions": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-shared/eslint.config.mts b/server/routerlicious/packages/services-shared/eslint.config.mts index 4f082866bb77..588f19d3b574 100644 --- a/server/routerlicious/packages/services-shared/eslint.config.mts +++ b/server/routerlicious/packages/services-shared/eslint.config.mts @@ -3,26 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-telemetry/eslint.config.mts b/server/routerlicious/packages/services-telemetry/eslint.config.mts index aa7b301f4857..588f19d3b574 100644 --- a/server/routerlicious/packages/services-telemetry/eslint.config.mts +++ b/server/routerlicious/packages/services-telemetry/eslint.config.mts @@ -3,22 +3,14 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "promise/catch-or-return": ["error", { allowFinally: true }], - - // TODO: remove these overrides and fix violations - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services-utils/eslint.config.mts b/server/routerlicious/packages/services-utils/eslint.config.mts index aa28e74f352a..d0867b09bc69 100644 --- a/server/routerlicious/packages/services-utils/eslint.config.mts +++ b/server/routerlicious/packages/services-utils/eslint.config.mts @@ -3,20 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove these overrides - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove these overrides - "@fluid-internal/fluid/no-unchecked-record-access": "warn", - "@typescript-eslint/strict-boolean-expressions": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + // TODO: services-utils was close to compliance, consider re-enabling + "@typescript-eslint/strict-boolean-expressions": "warn", + }, + }, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/services/eslint.config.mts b/server/routerlicious/packages/services/eslint.config.mts index 2b80e2a02943..6ce838080ea1 100644 --- a/server/routerlicious/packages/services/eslint.config.mts +++ b/server/routerlicious/packages/services/eslint.config.mts @@ -3,19 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "import-x/no-nodejs-modules": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove this override and fix violations - "@typescript-eslint/strict-boolean-expressions": "warn", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + files: ["**/*.{ts,tsx}"], + ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"], + rules: { + // TODO: services package was close to compliance, consider re-enabling + "@typescript-eslint/strict-boolean-expressions": "warn", + }, + }, + { + ignores: ["*.spec.ts"], }, -}; +]; + +export default config; diff --git a/server/routerlicious/packages/test-utils/eslint.config.mts b/server/routerlicious/packages/test-utils/eslint.config.mts index d407e868a19f..cdee5fced5b7 100644 --- a/server/routerlicious/packages/test-utils/eslint.config.mts +++ b/server/routerlicious/packages/test-utils/eslint.config.mts @@ -3,27 +3,22 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - rules: { - "@typescript-eslint/consistent-type-assertions": "off", - "@typescript-eslint/no-unsafe-return": "off", - "@typescript-eslint/no-use-before-define": "off", - "import-x/no-nodejs-modules": "off", - "no-case-declarations": "off", - "promise/catch-or-return": ["error", { allowFinally: true }], +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: enable strict null checks in tsconfig and remove these overrides - "@typescript-eslint/prefer-nullish-coalescing": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", - - // TODO: fix violations and remove this override - "@fluid-internal/fluid/no-unchecked-record-access": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + rules: { + // Package-specific rules + "@typescript-eslint/consistent-type-assertions": "off", + "@typescript-eslint/no-use-before-define": "off", + "no-case-declarations": "off", + }, }, -}; + { + ignores: ["*.spec.ts", "*.generated.ts"], + }, +]; + +export default config; diff --git a/server/routerlicious/packages/tinylicious/eslint.config.mts b/server/routerlicious/packages/tinylicious/eslint.config.mts index 0adb4bfd9f34..513a1a971bac 100644 --- a/server/routerlicious/packages/tinylicious/eslint.config.mts +++ b/server/routerlicious/packages/tinylicious/eslint.config.mts @@ -3,25 +3,19 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [ - require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"), - "prettier", - ], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/promise-function-async": "off", - "@typescript-eslint/strict-boolean-expressions": "off", - "import-x/no-internal-modules": "off", - "import-x/no-nodejs-modules": "off", - - // TODO: enable strict null checks in tsconfig and remove this override - "@typescript-eslint/prefer-nullish-coalescing": "off", +import type { Linter } from "eslint"; +import { baseConfig } from "../../eslint.config.base.mts"; - // TODO: remove usages of deprecated APIs and remove this override - "import-x/no-deprecated": "warn", +const config: Linter.Config[] = [ + ...baseConfig, + { + rules: { + // Package-specific rules + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/promise-function-async": "off", + "import-x/no-internal-modules": "off", + }, }, -}; +]; + +export default config; diff --git a/tools/api-markdown-documenter/eslint.config.mts b/tools/api-markdown-documenter/eslint.config.mts index f7d36278ce42..6a2fe9a2d2f7 100644 --- a/tools/api-markdown-documenter/eslint.config.mts +++ b/tools/api-markdown-documenter/eslint.config.mts @@ -1,58 +1,43 @@ -/*! - * Copyright (c) Microsoft Corporation and contributors. All rights reserved. - * Licensed under the MIT License. +/* eslint-disable */ +/** + * GENERATED FILE - DO NOT EDIT DIRECTLY. + * To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript */ +import type { Linter } from "eslint"; +import { strict } from "../../common/build/eslint-config-fluid/flat.mts"; -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"], - parserOptions: { - project: ["./tsconfig.json"], +const config: Linter.Config[] = [ + ...strict, + { + rules: { + "@fluid-internal/fluid/no-unchecked-record-access": "off", + "@typescript-eslint/class-literal-property-style": "off", + "@typescript-eslint/no-unsafe-enum-comparison": "off", + "unicorn/prevent-abbreviations": [ + "error", + { + "allowList": { + "i": true, + }, + }, + ], + "unicorn/prefer-module": "off", + "unicorn/prefer-negative-index": "off", + "import/no-nodejs-modules": "off", + }, }, - rules: { - // Too many false positives with array access - "@fluid-internal/fluid/no-unchecked-record-access": "off", - - // Rule is reported in a lot of places where it would be invalid to follow the suggested pattern - "@typescript-eslint/class-literal-property-style": "off", - - // Comparing general input strings against system-known values (via enums) is used commonly to support - // extensibility. - "@typescript-eslint/no-unsafe-enum-comparison": "off", - - // Useful for developer accessibility - "unicorn/prevent-abbreviations": [ - "error", - { - allowList: { - // Industry-standard index variable name. - i: true, + { + files: ["src/**/test/**"], + rules: { + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": true, }, - }, - ], - - "unicorn/prefer-module": "off", - "unicorn/prefer-negative-index": "off", - - // This package is exclusively used in a Node.js context - "import/no-nodejs-modules": "off", + ], + "@typescript-eslint/no-unused-expressions": "off", + }, }, - overrides: [ - { - // Overrides for test files - files: ["src/**/test/**"], - plugins: ["chai-expect", "chai-friendly"], - extends: ["plugin:chai-expect/recommended", "plugin:chai-friendly/recommended"], - rules: { - "import/no-extraneous-dependencies": [ - "error", - { - devDependencies: true, - }, - ], +]; - // Handled by chai-friendly instead. - "@typescript-eslint/no-unused-expressions": "off", - }, - }, - ], -}; +export default config; diff --git a/tools/benchmark/eslint.config.mts b/tools/benchmark/eslint.config.mts index bafd78a2846b..c97829b2674e 100644 --- a/tools/benchmark/eslint.config.mts +++ b/tools/benchmark/eslint.config.mts @@ -3,25 +3,86 @@ * Licensed under the MIT License. */ -module.exports = { - extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], - parserOptions: { - project: ["./tsconfig.json", "./src/test/tsconfig.json"], - }, - rules: { - "@typescript-eslint/no-shadow": "off", - "space-before-function-paren": "off", // Off because it conflicts with typescript-formatter - "import/no-nodejs-modules": [ - "error", - { allow: ["node:v8", "perf_hooks", "node:child_process"] }, - ], +// TODO: Replace this local config with the shared @fluidframework/eslint-config-fluid +// flat config once v9 is released. Example: +// import { recommended } from "@fluidframework/eslint-config-fluid/flat.mts"; +// ...recommended, + +import eslint from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import importPlugin from "eslint-plugin-import-x"; +import unicorn from "eslint-plugin-unicorn"; +import type { Linter } from "eslint"; +import tseslint from "typescript-eslint"; + +const config: Linter.Config[] = [ + // Base ESLint recommended rules + eslint.configs.recommended, + + // TypeScript ESLint recommended rules (type-checked) + ...tseslint.configs.recommendedTypeChecked, + + // import-x plugin for import rules + importPlugin.flatConfigs.recommended as Linter.Config, + importPlugin.flatConfigs.typescript as Linter.Config, + + // Unicorn plugin - register plugin so eslint-disable comments for unicorn rules are valid. + // Only specific rules are enabled; the full recommended preset is not used due to a + // compatibility issue between eslint-plugin-unicorn@54 and eslint@9.39 (expiring-todo-comments). + { + plugins: { + unicorn, + }, + rules: { + "unicorn/prefer-module": "error", + "unicorn/prefer-native-coercion-functions": "error", + "unicorn/prefer-ternary": "error", + "unicorn/no-negated-condition": "error", + }, }, - overrides: [ - { - files: ["src/test/**"], - rules: { - "import/no-nodejs-modules": "off", + + // TypeScript parser and project configuration + { + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + settings: { + "import-x/resolver": { + typescript: true, + node: true, }, }, - ], -}; + }, + + // Project-specific rule overrides + { + rules: { + "@typescript-eslint/no-shadow": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/require-await": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "import-x/no-nodejs-modules": [ + "error", + { allow: ["node:v8", "perf_hooks", "node:child_process"] }, + ], + }, + }, + + // Test file overrides + { + files: ["src/test/**"], + rules: { + "import-x/no-nodejs-modules": "off", + }, + }, + + // Prettier config - disables rules that conflict with prettier. Must be last so + // no subsequent config objects can re-enable formatting rules. + eslintConfigPrettier, +]; + +export default config;