|
| 1 | +import jsdoc from "eslint-plugin-jsdoc"; |
| 2 | +import preferArrow from "eslint-plugin-prefer-arrow"; |
| 3 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 4 | +import header from "@tony.ganchev/eslint-plugin-header"; |
| 5 | +import globals from "globals"; |
| 6 | +import tsParser from "@typescript-eslint/parser"; |
| 7 | +import path from "node:path"; |
| 8 | +import { fileURLToPath } from "node:url"; |
| 9 | +import js from "@eslint/js"; |
| 10 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 11 | + |
| 12 | +const __filename = fileURLToPath(import.meta.url); |
| 13 | +const __dirname = path.dirname(__filename); |
| 14 | +const compat = new FlatCompat({ |
| 15 | + baseDirectory: __dirname, |
| 16 | + recommendedConfig: js.configs.recommended, |
| 17 | + allConfig: js.configs.all |
| 18 | +}); |
| 19 | + |
| 20 | +export default [{ |
| 21 | + ignores: [ |
| 22 | + "**/.eslintrc.js", |
| 23 | + "**/*.mjs", |
| 24 | + "**/*.js", |
| 25 | + "**/*.js.map", |
| 26 | + "**/*.d.ts", |
| 27 | + "**/node_modules/", |
| 28 | + "**/dist/", |
| 29 | + ], |
| 30 | + files: ["**/*.ts"], |
| 31 | +}, ...compat.extends( |
| 32 | + "eslint:recommended", |
| 33 | + "plugin:@typescript-eslint/recommended-type-checked", |
| 34 | + "plugin:@typescript-eslint/stylistic-type-checked", |
| 35 | + "prettier", |
| 36 | + "@microsoft/eslint-config-msgraph/core", |
| 37 | +), { |
| 38 | + plugins: { |
| 39 | + jsdoc, |
| 40 | + "prefer-arrow": preferArrow, |
| 41 | + "@typescript-eslint": typescriptEslint, |
| 42 | + header, |
| 43 | + }, |
| 44 | + |
| 45 | + languageOptions: { |
| 46 | + globals: { |
| 47 | + ...globals.browser, |
| 48 | + ...globals.node, |
| 49 | + }, |
| 50 | + |
| 51 | + parser: tsParser, |
| 52 | + ecmaVersion: 6, |
| 53 | + sourceType: "module", |
| 54 | + |
| 55 | + parserOptions: { |
| 56 | + project: [ |
| 57 | + "packages/abstractions/tsconfig.json", |
| 58 | + "packages/authentication/azure/tsconfig.json", |
| 59 | + "packages/authentication/azure/tsconfig.json", |
| 60 | + "packages/http/fetch/tsconfig.json", |
| 61 | + "packages/serialization/form/tsconfig.json", |
| 62 | + "packages/serialization/json/tsconfig.json", |
| 63 | + "packages/serialization/multipart/tsconfig.json", |
| 64 | + "packages/authentication/azure/tsconfig.json", |
| 65 | + "packages/test/tsconfig.json", |
| 66 | + ], |
| 67 | + }, |
| 68 | + }, |
| 69 | + |
| 70 | + rules: { |
| 71 | + "@typescript-eslint/class-literal-property-style": ["error", "fields"], |
| 72 | + "@typescript-eslint/no-explicit-any": "warn", |
| 73 | + "prefer-arrow/prefer-arrow-functions": "warn", |
| 74 | + "@typescript-eslint/prefer-nullish-coalescing": "off", |
| 75 | + |
| 76 | + "header/header": [2, "block", [ |
| 77 | + "*", |
| 78 | + " * -------------------------------------------------------------------------------------------", |
| 79 | + " * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.", |
| 80 | + " * See License in the project root for license information.", |
| 81 | + " * -------------------------------------------------------------------------------------------", |
| 82 | + " ", |
| 83 | + ], 1], |
| 84 | + }, |
| 85 | +}]; |
0 commit comments