@@ -3,110 +3,124 @@ const js = require("@eslint/js");
33const path = require ( "path" ) ;
44
55const compat = new FlatCompat ( {
6- baseDirectory : __dirname ,
7- recommendedConfig : js . configs . recommended ,
8- allConfig : js . configs . all
6+ baseDirectory : __dirname ,
7+ recommendedConfig : js . configs . recommended ,
8+ allConfig : js . configs . all ,
99} ) ;
1010
1111module . exports = [
12- {
13- ignores : [
14- "lib/" ,
15- "dev/" ,
16- "node_modules/" ,
17- "coverage/" ,
18- "docgen/" ,
19- "v1/" ,
20- "v2/" ,
21- "logger/" ,
22- "dist/" ,
23- "spec/fixtures/" ,
24- "scripts/**/*.js" ,
25- "scripts/**/*.mjs" ,
26- "protos/" ,
27- ".prettierrc.js" ,
28- "eslint.config.*" ,
29- "tsdown.config.*" ,
30- "scripts/bin-test/sources/esm-ext/index.mjs" ,
31- ] ,
12+ {
13+ ignores : [
14+ "lib/" ,
15+ "dev/" ,
16+ "node_modules/" ,
17+ "coverage/" ,
18+ "docgen/" ,
19+ "v1/" ,
20+ "v2/" ,
21+ "logger/" ,
22+ "dist/" ,
23+ "spec/fixtures/" ,
24+ "scripts/**/*.js" ,
25+ "scripts/**/*.mjs" ,
26+ "protos/" ,
27+ ".prettierrc.js" ,
28+ "eslint.config.*" ,
29+ "tsdown.config.*" ,
30+ "scripts/bin-test/sources/esm-ext/index.mjs" ,
31+ "integration_test/functions/lib/" ,
32+ ] ,
33+ } ,
34+ ...compat . extends (
35+ "eslint:recommended" ,
36+ "plugin:@typescript-eslint/recommended" ,
37+ "plugin:@typescript-eslint/recommended-requiring-type-checking" ,
38+ "plugin:jsdoc/recommended" ,
39+ "google" ,
40+ "prettier"
41+ ) ,
42+ {
43+ languageOptions : {
44+ parser : require ( "@typescript-eslint/parser" ) ,
45+ parserOptions : {
46+ project : "tsconfig.json" ,
47+ tsconfigRootDir : __dirname ,
48+ } ,
49+ ecmaVersion : 2022 ,
3250 } ,
33- ...compat . extends (
34- "eslint:recommended" ,
35- "plugin:@typescript-eslint/recommended" ,
36- "plugin:@typescript-eslint/recommended-requiring-type-checking" ,
37- "plugin:jsdoc/recommended" ,
38- "google" ,
39- "prettier"
40- ) ,
41- {
42- languageOptions : {
43- parser : require ( "@typescript-eslint/parser" ) ,
44- parserOptions : {
45- project : "tsconfig.json" ,
46- tsconfigRootDir : __dirname ,
47- } ,
48- ecmaVersion : 2022
49- } ,
50- plugins : {
51- "prettier" : require ( "eslint-plugin-prettier" ) ,
52- } ,
53- rules : {
54- "jsdoc/newline-after-description" : "off" ,
55- "jsdoc/require-jsdoc" : [ "warn" , { publicOnly : true } ] ,
56- "jsdoc/check-tag-names" : [ "warn" , { definedTags : [ "alpha" , "remarks" , "typeParam" , "packageDocumentation" , "hidden" ] } ] ,
57- "no-restricted-globals" : [ "error" , "name" , "length" ] ,
58- "prefer-arrow-callback" : "error" ,
59- "prettier/prettier" : "error" ,
60- "require-atomic-updates" : "off" , // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
61- "require-jsdoc" : "off" , // This rule is deprecated and superseded by jsdoc/require-jsdoc.
62- "valid-jsdoc" : "off" , // This is deprecated but included in recommended configs.
63- "no-prototype-builtins" : "warn" ,
64- "no-useless-escape" : "warn" ,
65- "prefer-promise-reject-errors" : "warn" ,
66- } ,
51+ plugins : {
52+ prettier : require ( "eslint-plugin-prettier" ) ,
6753 } ,
68- {
69- files : [ "**/*.ts" ] ,
70- rules : {
71- "jsdoc/require-param-type" : "off" ,
72- "jsdoc/require-returns-type" : "off" ,
73- // Google style guide allows us to omit trivial parameters and returns
74- "jsdoc/require-param" : "off" ,
75- "jsdoc/require-returns" : "off" ,
54+ rules : {
55+ "jsdoc/newline-after-description" : "off" ,
56+ "jsdoc/require-jsdoc" : [ "warn" , { publicOnly : true } ] ,
57+ "jsdoc/check-tag-names" : [
58+ "warn" ,
59+ { definedTags : [ "alpha" , "remarks" , "typeParam" , "packageDocumentation" , "hidden" ] } ,
60+ ] ,
61+ "no-restricted-globals" : [ "error" , "name" , "length" ] ,
62+ "prefer-arrow-callback" : "error" ,
63+ "prettier/prettier" : "error" ,
64+ "require-atomic-updates" : "off" , // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
65+ "require-jsdoc" : "off" , // This rule is deprecated and superseded by jsdoc/require-jsdoc.
66+ "valid-jsdoc" : "off" , // This is deprecated but included in recommended configs.
67+ "no-prototype-builtins" : "warn" ,
68+ "no-useless-escape" : "warn" ,
69+ "prefer-promise-reject-errors" : "warn" ,
70+ } ,
71+ } ,
72+ {
73+ files : [ "**/*.ts" ] ,
74+ rules : {
75+ "jsdoc/require-param-type" : "off" ,
76+ "jsdoc/require-returns-type" : "off" ,
77+ // Google style guide allows us to omit trivial parameters and returns
78+ "jsdoc/require-param" : "off" ,
79+ "jsdoc/require-returns" : "off" ,
7680
77- "@typescript-eslint/no-invalid-this" : "error" ,
78- "@typescript-eslint/no-unused-vars" : [ "error" , { argsIgnorePattern : "^_" , caughtErrorsIgnorePattern : "^_" } ] , // Unused vars should not exist.
79- "@typescript-eslint/no-misused-promises" : "warn" , // rule does not work with async handlers for express.
80- "no-invalid-this" : "off" , // Turned off in favor of @typescript -eslint/no-invalid-this.
81- "no-unused-vars" : "off" , // Off in favor of @typescript -eslint/no-unused-vars.
82- eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
83- camelcase : [ "error" , { properties : "never" } ] , // snake_case allowed in properties iif to satisfy an external contract / style
81+ "@typescript-eslint/no-invalid-this" : "error" ,
82+ "@typescript-eslint/no-unused-vars" : [
83+ "error" ,
84+ { argsIgnorePattern : "^_" , caughtErrorsIgnorePattern : "^_" } ,
85+ ] , // Unused vars should not exist.
86+ "@typescript-eslint/no-misused-promises" : "warn" , // rule does not work with async handlers for express.
87+ "no-invalid-this" : "off" , // Turned off in favor of @typescript -eslint/no-invalid-this.
88+ "no-unused-vars" : "off" , // Off in favor of @typescript -eslint/no-unused-vars.
89+ eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
90+ camelcase : [ "error" , { properties : "never" } ] , // snake_case allowed in properties iif to satisfy an external contract / style
8491
85- // Ideally, all these warning should be error - let's fix them in the future.
86- "@typescript-eslint/no-unsafe-argument" : "warn" ,
87- "@typescript-eslint/no-unsafe-assignment" : "warn" ,
88- "@typescript-eslint/no-unsafe-call" : "warn" ,
89- "@typescript-eslint/no-unsafe-member-access" : "warn" ,
90- "@typescript-eslint/no-unsafe-return" : "warn" ,
91- "@typescript-eslint/restrict-template-expressions" : "warn" ,
92- "@typescript-eslint/no-explicit-any" : "warn" ,
93- "@typescript-eslint/no-redundant-type-constituents" : "warn" ,
94- "@typescript-eslint/no-base-to-string" : "warn" ,
95- "@typescript-eslint/no-duplicate-type-constituents" : "warn" ,
96- "@typescript-eslint/no-require-imports" : "warn" ,
97- "@typescript-eslint/no-empty-object-type" : "warn" ,
98- "@typescript-eslint/prefer-promise-reject-errors" : "warn" ,
99- } ,
92+ // Ideally, all these warning should be error - let's fix them in the future.
93+ "@typescript-eslint/no-unsafe-argument" : "warn" ,
94+ "@typescript-eslint/no-unsafe-assignment" : "warn" ,
95+ "@typescript-eslint/no-unsafe-call" : "warn" ,
96+ "@typescript-eslint/no-unsafe-member-access" : "warn" ,
97+ "@typescript-eslint/no-unsafe-return" : "warn" ,
98+ "@typescript-eslint/restrict-template-expressions" : "warn" ,
99+ "@typescript-eslint/no-explicit-any" : "warn" ,
100+ "@typescript-eslint/no-redundant-type-constituents" : "warn" ,
101+ "@typescript-eslint/no-base-to-string" : "warn" ,
102+ "@typescript-eslint/no-duplicate-type-constituents" : "warn" ,
103+ "@typescript-eslint/no-require-imports" : "warn" ,
104+ "@typescript-eslint/no-empty-object-type" : "warn" ,
105+ "@typescript-eslint/prefer-promise-reject-errors" : "warn" ,
106+ } ,
107+ } ,
108+ {
109+ files : [
110+ "**/*.spec.ts" ,
111+ "**/*.spec.js" ,
112+ "spec/helper.ts" ,
113+ "scripts/bin-test/**/*.ts" ,
114+ "integration_test/**/*.ts" ,
115+ ] ,
116+ languageOptions : {
117+ globals : {
118+ mocha : true ,
119+ } ,
100120 } ,
101- {
102- files : [ "**/*.spec.ts" , "**/*.spec.js" , "spec/helper.ts" , "scripts/bin-test/**/*.ts" , "integration_test/**/*.ts" ] ,
103- languageOptions : {
104- globals : {
105- mocha : true ,
106- } ,
107- } ,
108- rules : {
109- "@typescript-eslint/no-unused-expressions" : "off" ,
110- }
121+ rules : {
122+ "@typescript-eslint/no-unused-expressions" : "off" ,
123+ "@typescript-eslint/no-unnecessary-type-assertion" : "off" ,
111124 } ,
125+ } ,
112126] ;
0 commit comments