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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions azure/packages/azure-local-service/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
55 changes: 29 additions & 26 deletions azure/packages/azure-service-utils/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
136 changes: 23 additions & 113 deletions build-tools/packages/build-cli/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
};
},
];
46 changes: 12 additions & 34 deletions build-tools/packages/build-infrastructure/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
];
80 changes: 62 additions & 18 deletions build-tools/packages/build-tools/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
};
];
17 changes: 2 additions & 15 deletions build-tools/packages/bundle-size-tools/eslint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading