@stride.it/appoint-lint-governance 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -153,13 +153,20 @@ function typescriptQuality(options = {}) {
|
|
|
153
153
|
// src/configs/typescript/security.ts
|
|
154
154
|
import regexpPlugin from "eslint-plugin-regexp";
|
|
155
155
|
import rushstackSecurity from "@rushstack/eslint-plugin-security";
|
|
156
|
+
import securityPlugin from "eslint-plugin-security";
|
|
156
157
|
import tseslint5 from "typescript-eslint";
|
|
157
158
|
function typescriptSecurity(options = {}) {
|
|
158
159
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
160
|
+
const mergedSecurity = {
|
|
161
|
+
rules: {
|
|
162
|
+
...securityPlugin.rules ?? {},
|
|
163
|
+
...rushstackSecurity.rules ?? {}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
159
166
|
return tseslint5.config({
|
|
160
167
|
files,
|
|
161
168
|
plugins: {
|
|
162
|
-
security:
|
|
169
|
+
security: mergedSecurity,
|
|
163
170
|
regexp: regexpPlugin
|
|
164
171
|
},
|
|
165
172
|
rules: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/index.ts","../src/configs/typescript/base.ts","../src/configs/typescript/docs.ts","../src/configs/typescript/imports.ts","../src/configs/typescript/minimal.ts","../src/configs/typescript/recommended.ts","../src/configs/typescript/quality.ts","../src/configs/typescript/security.ts","../src/configs/typescript/type-aware.ts","../src/configs/typescript/prettier.ts"],"sourcesContent":["import type { ESLint } from \"eslint\";\r\n\r\n/**\r\n * Placeholder for future custom rules.\r\n *\r\n * Exporting a plugin object now keeps the package structure stable as you add\r\n * domain-specific rules later.\r\n */\r\nexport const plugin: ESLint.Plugin = {\r\n rules: {},\r\n};\r\n","import tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptBaseOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptBase(options: TypescriptBaseOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n \"@typescript-eslint\": tseslint.plugin,\r\n },\r\n languageOptions: {\r\n parser: tseslint.parser,\r\n parserOptions: {\r\n ecmaVersion: \"latest\",\r\n sourceType: \"module\",\r\n },\r\n },\r\n rules: {\r\n \"@typescript-eslint/consistent-type-imports\": \"error\",\r\n \"@typescript-eslint/no-unused-vars\": \"error\",\r\n \"@typescript-eslint/no-shadow\": \"error\",\r\n \"@typescript-eslint/ban-ts-comment\": \"error\",\r\n \"@typescript-eslint/require-await\": \"error\",\r\n \"@typescript-eslint/no-explicit-any\": \"warn\",\r\n \"@typescript-eslint/no-inferrable-types\": \"error\",\r\n \"no-undef\": \"off\",\r\n \"no-unused-vars\": \"off\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport jsdoc from \"eslint-plugin-jsdoc\";\r\nimport comments from \"@eslint-community/eslint-plugin-eslint-comments\";\r\n\r\nexport interface TypescriptDocsOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptDocs(options: TypescriptDocsOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n jsdoc: jsdoc,\r\n \"eslint-comments\": comments,\r\n },\r\n rules: {\r\n \"eslint-comments/no-unused-disable\": \"error\",\r\n \"eslint-comments/require-description\": \"error\",\r\n \"eslint-comments/disable-enable-pair\": \"error\",\r\n \"jsdoc/check-alignment\": \"error\",\r\n \"jsdoc/require-param\": \"error\",\r\n \"jsdoc/require-returns\": \"error\",\r\n },\r\n });\r\n}\r\n","import importPlugin from \"eslint-plugin-import\";\r\nimport simpleImportSort from \"eslint-plugin-simple-import-sort\";\r\nimport tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptImportsOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptImports(options: TypescriptImportsOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n import: importPlugin,\r\n \"simple-import-sort\": simpleImportSort,\r\n },\r\n settings: {\r\n \"import/parsers\": {\r\n \"@typescript-eslint/parser\": [\".ts\", \".tsx\", \".mts\", \".cts\"],\r\n },\r\n \"import/resolver\": {\r\n typescript: {\r\n alwaysTryTypes: true,\r\n project: [\"tsconfig.json\", \"*/tsconfig.json\"],\r\n },\r\n node: true,\r\n },\r\n },\r\n rules: {\r\n // Import Correctness\r\n \"import/no-duplicates\": \"error\",\r\n \"import/no-cycle\": \"error\",\r\n \"import/no-mutable-exports\": \"error\",\r\n \"import/first\": \"error\",\r\n \"import/newline-after-import\": \"error\",\r\n\r\n // Sorting\r\n \"simple-import-sort/imports\": \"error\",\r\n \"simple-import-sort/exports\": \"error\",\r\n },\r\n });\r\n}\r\n","import { typescriptBase } from \"./base.js\";\r\n\r\nexport type TypescriptConfigFiles = string[];\r\n\r\nexport interface TypescriptMinimalOptions {\r\n files?: TypescriptConfigFiles;\r\n}\r\n\r\n/**\r\n * MVP TypeScript profile.\r\n *\r\n * Intentionally minimal: enables TypeScript parsing and one rule to prove\r\n * end-to-end packaging + consumption.\r\n */\r\nexport function typescriptMinimal(options: TypescriptMinimalOptions = {}) {\r\n return typescriptBase(options);\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport { typescriptBase } from \"./base.js\";\r\nimport { typescriptImports } from \"./imports.js\";\r\nimport { typescriptQuality } from \"./quality.js\";\r\nimport { typescriptSecurity } from \"./security.js\";\r\nimport { typescriptDocs } from \"./docs.js\";\r\nimport { typescriptTypeAware } from \"./type-aware.js\";\r\n\r\nexport interface TypescriptRecommendedOptions {\r\n /**\r\n * When set, enables type-aware rules (more powerful, can be slower).\r\n *\r\n * Recommended for mature codebases, but not required for MVP.\r\n */\r\n typeChecked?: boolean;\r\n\r\n /**\r\n * Type-aware linting requires a project TSConfig.\r\n * Example: \"./tsconfig.json\".\r\n */\r\n tsconfigPath?: string | string[];\r\n\r\n /**\r\n * tsconfigRootDir should usually be import.meta.dirname from the consumer repo.\r\n */\r\n tsconfigRootDir?: string;\r\n\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptRecommended(\r\n options: TypescriptRecommendedOptions = {}\r\n) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n const upstreamConfigs = options.typeChecked\r\n ? tseslint.configs.recommendedTypeChecked\r\n : tseslint.configs.recommended;\r\n\r\n const typeAwareConfig = options.typeChecked\r\n ? typescriptTypeAware({\r\n files,\r\n tsconfigPath: options.tsconfigPath,\r\n tsconfigRootDir: options.tsconfigRootDir,\r\n })\r\n : [];\r\n\r\n return tseslint.config(\r\n ...typescriptBase({ files }),\r\n ...typescriptQuality({ files }),\r\n ...typescriptImports({ files }),\r\n ...typescriptSecurity(),\r\n ...typescriptDocs({ files }),\r\n ...typeAwareConfig,\r\n {\r\n files,\r\n extends: [...upstreamConfigs],\r\n }\r\n );\r\n}\r\n","import sonarjs from \"eslint-plugin-sonarjs\";\r\nimport unicorn from \"eslint-plugin-unicorn\";\r\nimport tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptQualityOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptQuality(options: TypescriptQualityOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n unicorn,\r\n sonarjs,\r\n },\r\n rules: {\r\n // Unicorn\r\n \"unicorn/prefer-node-protocol\": \"error\",\r\n \"unicorn/no-useless-undefined\": \"error\",\r\n \"unicorn/no-lonely-if\": \"error\",\r\n \"unicorn/prefer-optional-catch-binding\": \"error\",\r\n \"unicorn/prefer-string-replace-all\": \"error\",\r\n \"unicorn/prevent-abbreviations\": [\r\n \"warn\",\r\n {\r\n allowList: {\r\n Props: true,\r\n props: true,\r\n Ref: true,\r\n ref: true,\r\n Src: true,\r\n src: true,\r\n Params: true,\r\n params: true,\r\n Env: true,\r\n env: true,\r\n Args: true,\r\n args: true,\r\n },\r\n },\r\n ],\r\n\r\n // SonarJS\r\n \"sonarjs/cognitive-complexity\": [\"warn\", 15],\r\n \"sonarjs/no-identical-functions\": \"error\",\r\n \"sonarjs/no-duplicated-branches\": \"error\",\r\n \"sonarjs/no-redundant-boolean\": \"error\",\r\n \"sonarjs/no-inverted-boolean-check\": \"error\",\r\n },\r\n });\r\n}\r\n","import regexpPlugin from \"eslint-plugin-regexp\";\r\nimport rushstackSecurity from \"@rushstack/eslint-plugin-security\";\r\nimport tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptSecurityOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptSecurity(options: TypescriptSecurityOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n security: rushstackSecurity,\r\n regexp: regexpPlugin,\r\n },\r\n rules: {\r\n // @rushstack/eslint-plugin-security\r\n \"security/detect-object-injection\": \"error\",\r\n \"security/detect-unsafe-regex\": \"error\",\r\n\r\n // eslint-plugin-regexp\r\n \"regexp/no-super-linear-backtracking\": \"error\",\r\n \"regexp/no-useless-escape\": \"error\",\r\n \"regexp/no-empty-capturing-group\": \"error\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptTypeAwareOptions {\r\n /**\r\n * Type-aware linting requires a project TSConfig.\r\n * Example: \"./tsconfig.json\".\r\n */\r\n tsconfigPath?: string | string[];\r\n\r\n /**\r\n * tsconfigRootDir should usually be import.meta.dirname from the consumer repo.\r\n */\r\n tsconfigRootDir?: string;\r\n\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptTypeAware(options: TypescriptTypeAwareOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n languageOptions: {\r\n parserOptions: {\r\n project: options.tsconfigPath ?? \"./tsconfig.json\",\r\n tsconfigRootDir: options.tsconfigRootDir,\r\n },\r\n },\r\n rules: {\r\n \"@typescript-eslint/no-floating-promises\": \"error\",\r\n \"@typescript-eslint/no-misused-promises\": \"error\",\r\n \"@typescript-eslint/await-thenable\": \"error\",\r\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\r\n \"@typescript-eslint/no-unnecessary-type-assertion\": \"error\",\r\n \"@typescript-eslint/restrict-template-expressions\": \"error\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport eslintConfigPrettier from \"eslint-config-prettier\";\r\n\r\nexport interface TypescriptPrettierOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptPrettierInterop(\r\n options: TypescriptPrettierOptions = {}\r\n) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n rules: {\r\n ...eslintConfigPrettier.rules,\r\n },\r\n });\r\n}\r\n"],"mappings":";AAQO,IAAM,SAAwB;AAAA,EACnC,OAAO,CAAC;AACV;;;ACVA,OAAO,cAAc;AAMd,SAAS,eAAe,UAAiC,CAAC,GAAG;AAClE,QAAM,QAAQ,QAAQ,SAAS,CAAC,uBAAuB;AAEvD,SAAO,SAAS,OAAO;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,MACP,sBAAsB,SAAS;AAAA,IACjC;AAAA,IACA,iBAAiB;AAAA,MACf,QAAQ,SAAS;AAAA,MACjB,eAAe;AAAA,QACb,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACL,8CAA8C;AAAA,MAC9C,qCAAqC;AAAA,MACrC,gCAAgC;AAAA,MAChC,qCAA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ACrB,OAAO,0BAA0B;AAM1B,SAAS,0BACd,UAAqC,CAAC,GACtC;AACA,QAAM,QAAQ,QAAQ,SAAS,CAAC,uBAAuB;AAEvD,SAAOA,UAAS,OAAO;AAAA,IACrB;AAAA,IACA,OAAO;AAAA,MACL,GAAG,qBAAqB;AAAA,IAC1B;AAAA,EACF,CAAC;AACH;","names":["tseslint","tseslint","tseslint","tseslint","tseslint","tseslint","tseslint","tseslint"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin/index.ts","../src/configs/typescript/base.ts","../src/configs/typescript/docs.ts","../src/configs/typescript/imports.ts","../src/configs/typescript/minimal.ts","../src/configs/typescript/recommended.ts","../src/configs/typescript/quality.ts","../src/configs/typescript/security.ts","../src/configs/typescript/type-aware.ts","../src/configs/typescript/prettier.ts"],"sourcesContent":["import type { ESLint } from \"eslint\";\r\n\r\n/**\r\n * Placeholder for future custom rules.\r\n *\r\n * Exporting a plugin object now keeps the package structure stable as you add\r\n * domain-specific rules later.\r\n */\r\nexport const plugin: ESLint.Plugin = {\r\n rules: {},\r\n};\r\n","import tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptBaseOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptBase(options: TypescriptBaseOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n \"@typescript-eslint\": tseslint.plugin,\r\n },\r\n languageOptions: {\r\n parser: tseslint.parser,\r\n parserOptions: {\r\n ecmaVersion: \"latest\",\r\n sourceType: \"module\",\r\n },\r\n },\r\n rules: {\r\n \"@typescript-eslint/consistent-type-imports\": \"error\",\r\n \"@typescript-eslint/no-unused-vars\": \"error\",\r\n \"@typescript-eslint/no-shadow\": \"error\",\r\n \"@typescript-eslint/ban-ts-comment\": \"error\",\r\n \"@typescript-eslint/require-await\": \"error\",\r\n \"@typescript-eslint/no-explicit-any\": \"warn\",\r\n \"@typescript-eslint/no-inferrable-types\": \"error\",\r\n \"no-undef\": \"off\",\r\n \"no-unused-vars\": \"off\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport jsdoc from \"eslint-plugin-jsdoc\";\r\nimport comments from \"@eslint-community/eslint-plugin-eslint-comments\";\r\n\r\nexport interface TypescriptDocsOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptDocs(options: TypescriptDocsOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n jsdoc: jsdoc,\r\n \"eslint-comments\": comments,\r\n },\r\n rules: {\r\n \"eslint-comments/no-unused-disable\": \"error\",\r\n \"eslint-comments/require-description\": \"error\",\r\n \"eslint-comments/disable-enable-pair\": \"error\",\r\n \"jsdoc/check-alignment\": \"error\",\r\n \"jsdoc/require-param\": \"error\",\r\n \"jsdoc/require-returns\": \"error\",\r\n },\r\n });\r\n}\r\n","import importPlugin from \"eslint-plugin-import\";\r\nimport simpleImportSort from \"eslint-plugin-simple-import-sort\";\r\nimport tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptImportsOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptImports(options: TypescriptImportsOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n import: importPlugin,\r\n \"simple-import-sort\": simpleImportSort,\r\n },\r\n settings: {\r\n \"import/parsers\": {\r\n \"@typescript-eslint/parser\": [\".ts\", \".tsx\", \".mts\", \".cts\"],\r\n },\r\n \"import/resolver\": {\r\n typescript: {\r\n alwaysTryTypes: true,\r\n project: [\"tsconfig.json\", \"*/tsconfig.json\"],\r\n },\r\n node: true,\r\n },\r\n },\r\n rules: {\r\n // Import Correctness\r\n \"import/no-duplicates\": \"error\",\r\n \"import/no-cycle\": \"error\",\r\n \"import/no-mutable-exports\": \"error\",\r\n \"import/first\": \"error\",\r\n \"import/newline-after-import\": \"error\",\r\n\r\n // Sorting\r\n \"simple-import-sort/imports\": \"error\",\r\n \"simple-import-sort/exports\": \"error\",\r\n },\r\n });\r\n}\r\n","import { typescriptBase } from \"./base.js\";\r\n\r\nexport type TypescriptConfigFiles = string[];\r\n\r\nexport interface TypescriptMinimalOptions {\r\n files?: TypescriptConfigFiles;\r\n}\r\n\r\n/**\r\n * MVP TypeScript profile.\r\n *\r\n * Intentionally minimal: enables TypeScript parsing and one rule to prove\r\n * end-to-end packaging + consumption.\r\n */\r\nexport function typescriptMinimal(options: TypescriptMinimalOptions = {}) {\r\n return typescriptBase(options);\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport { typescriptBase } from \"./base.js\";\r\nimport { typescriptImports } from \"./imports.js\";\r\nimport { typescriptQuality } from \"./quality.js\";\r\nimport { typescriptSecurity } from \"./security.js\";\r\nimport { typescriptDocs } from \"./docs.js\";\r\nimport { typescriptTypeAware } from \"./type-aware.js\";\r\n\r\nexport interface TypescriptRecommendedOptions {\r\n /**\r\n * When set, enables type-aware rules (more powerful, can be slower).\r\n *\r\n * Recommended for mature codebases, but not required for MVP.\r\n */\r\n typeChecked?: boolean;\r\n\r\n /**\r\n * Type-aware linting requires a project TSConfig.\r\n * Example: \"./tsconfig.json\".\r\n */\r\n tsconfigPath?: string | string[];\r\n\r\n /**\r\n * tsconfigRootDir should usually be import.meta.dirname from the consumer repo.\r\n */\r\n tsconfigRootDir?: string;\r\n\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptRecommended(\r\n options: TypescriptRecommendedOptions = {}\r\n) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n const upstreamConfigs = options.typeChecked\r\n ? tseslint.configs.recommendedTypeChecked\r\n : tseslint.configs.recommended;\r\n\r\n const typeAwareConfig = options.typeChecked\r\n ? typescriptTypeAware({\r\n files,\r\n tsconfigPath: options.tsconfigPath,\r\n tsconfigRootDir: options.tsconfigRootDir,\r\n })\r\n : [];\r\n\r\n return tseslint.config(\r\n ...typescriptBase({ files }),\r\n ...typescriptQuality({ files }),\r\n ...typescriptImports({ files }),\r\n ...typescriptSecurity(),\r\n ...typescriptDocs({ files }),\r\n ...typeAwareConfig,\r\n {\r\n files,\r\n extends: [...upstreamConfigs],\r\n }\r\n );\r\n}\r\n","import sonarjs from \"eslint-plugin-sonarjs\";\r\nimport unicorn from \"eslint-plugin-unicorn\";\r\nimport tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptQualityOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptQuality(options: TypescriptQualityOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n unicorn,\r\n sonarjs,\r\n },\r\n rules: {\r\n // Unicorn\r\n \"unicorn/prefer-node-protocol\": \"error\",\r\n \"unicorn/no-useless-undefined\": \"error\",\r\n \"unicorn/no-lonely-if\": \"error\",\r\n \"unicorn/prefer-optional-catch-binding\": \"error\",\r\n \"unicorn/prefer-string-replace-all\": \"error\",\r\n \"unicorn/prevent-abbreviations\": [\r\n \"warn\",\r\n {\r\n allowList: {\r\n Props: true,\r\n props: true,\r\n Ref: true,\r\n ref: true,\r\n Src: true,\r\n src: true,\r\n Params: true,\r\n params: true,\r\n Env: true,\r\n env: true,\r\n Args: true,\r\n args: true,\r\n },\r\n },\r\n ],\r\n\r\n // SonarJS\r\n \"sonarjs/cognitive-complexity\": [\"warn\", 15],\r\n \"sonarjs/no-identical-functions\": \"error\",\r\n \"sonarjs/no-duplicated-branches\": \"error\",\r\n \"sonarjs/no-redundant-boolean\": \"error\",\r\n \"sonarjs/no-inverted-boolean-check\": \"error\",\r\n },\r\n });\r\n}\r\n","import regexpPlugin from \"eslint-plugin-regexp\";\r\nimport rushstackSecurity from \"@rushstack/eslint-plugin-security\";\r\nimport securityPlugin from \"eslint-plugin-security\";\r\nimport tseslint, { type FlatConfig } from \"typescript-eslint\";\r\n\r\nexport interface TypescriptSecurityOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptSecurity(options: TypescriptSecurityOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n const mergedSecurity = {\r\n rules: {\r\n ...((securityPlugin as unknown as { rules?: Record<string, unknown> })\r\n .rules ?? {}),\r\n ...((rushstackSecurity as unknown as { rules?: Record<string, unknown> })\r\n .rules ?? {}),\r\n },\r\n } as unknown as FlatConfig.Plugin;\r\n\r\n return tseslint.config({\r\n files,\r\n plugins: {\r\n security: mergedSecurity,\r\n regexp: regexpPlugin,\r\n },\r\n rules: {\r\n // @rushstack/eslint-plugin-security\r\n \"security/detect-object-injection\": \"error\",\r\n \"security/detect-unsafe-regex\": \"error\",\r\n\r\n // eslint-plugin-regexp\r\n \"regexp/no-super-linear-backtracking\": \"error\",\r\n \"regexp/no-useless-escape\": \"error\",\r\n \"regexp/no-empty-capturing-group\": \"error\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\n\r\nexport interface TypescriptTypeAwareOptions {\r\n /**\r\n * Type-aware linting requires a project TSConfig.\r\n * Example: \"./tsconfig.json\".\r\n */\r\n tsconfigPath?: string | string[];\r\n\r\n /**\r\n * tsconfigRootDir should usually be import.meta.dirname from the consumer repo.\r\n */\r\n tsconfigRootDir?: string;\r\n\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptTypeAware(options: TypescriptTypeAwareOptions = {}) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n languageOptions: {\r\n parserOptions: {\r\n project: options.tsconfigPath ?? \"./tsconfig.json\",\r\n tsconfigRootDir: options.tsconfigRootDir,\r\n },\r\n },\r\n rules: {\r\n \"@typescript-eslint/no-floating-promises\": \"error\",\r\n \"@typescript-eslint/no-misused-promises\": \"error\",\r\n \"@typescript-eslint/await-thenable\": \"error\",\r\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\r\n \"@typescript-eslint/no-unnecessary-type-assertion\": \"error\",\r\n \"@typescript-eslint/restrict-template-expressions\": \"error\",\r\n },\r\n });\r\n}\r\n","import tseslint from \"typescript-eslint\";\r\nimport eslintConfigPrettier from \"eslint-config-prettier\";\r\n\r\nexport interface TypescriptPrettierOptions {\r\n files?: string[];\r\n}\r\n\r\nexport function typescriptPrettierInterop(\r\n options: TypescriptPrettierOptions = {}\r\n) {\r\n const files = options.files ?? [\"**/*.{ts,tsx,mts,cts}\"];\r\n\r\n return tseslint.config({\r\n files,\r\n rules: {\r\n ...eslintConfigPrettier.rules,\r\n },\r\n });\r\n}\r\n"],"mappings":";AAQO,IAAM,SAAwB;AAAA,EACnC,OAAO,CAAC;AACV;;;ACVA,OAAO,cAAc;AAMd,SAAS,eAAe,UAAiC,CAAC,GAAG;AAClE,QAAM,QAAQ,QAAQ,SAAS,CAAC,uBAAuB;AAEvD,SAAO,SAAS,OAAO;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,MACP,sBAAsB,SAAS;AAAA,IACjC;AAAA,IACA,iBAAiB;AAAA,MACf,QAAQ,SAAS;AAAA,MACjB,eAAe;AAAA,QACb,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACL,8CAA8C;AAAA,MAC9C,qCAAqC;AAAA,MACrC,gCAAgC;AAAA,MAChC,qCAAqC;AAAA,MACrC,oCAAoC;AAAA,MACpC,sCAAsC;AAAA,MACtC,0CAA0C;AAAA,MAC1C,YAAY;AAAA,MACZ,kBAAkB;AAAA,IACpB;AAAA,EACF,CAAC;AACH;;;ACjCA,OAAOA,eAAc;AACrB,OAAO,WAAW;AAClB,OAAO,cAAc;AAMd,SAAS,eAAe,UAAiC,CAAC,GAAG;AAClE,QAAM,QAAQ,QAAQ,SAAS,CAAC,uBAAuB;AAEvD,SAAOA,UAAS,OAAO;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,MAC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C1B;AAAA,EACF,CAAC;AACH;","names":["tseslint","tseslint","tseslint","tseslint","tseslint","tseslint","tseslint","tseslint"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stride.it/appoint-lint-governance",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Shareable ESLint flat-config profiles (MVP: TypeScript) for normalizing lint across repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
31
31
|
"@rushstack/eslint-plugin-security": "^0.8.0",
|
|
32
|
+
"eslint-plugin-security": "^3.0.1",
|
|
32
33
|
"eslint-config-prettier": "^10.1.8",
|
|
33
34
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
34
35
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -52,4 +53,4 @@
|
|
|
52
53
|
"typescript": "^5.9.3",
|
|
53
54
|
"vitest": "^4.0.17"
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|