Skip to content

Commit 9f9ba2e

Browse files
committed
build: disable various JSDoc rules for TS test files
1 parent abf0407 commit 9f9ba2e

File tree

3 files changed

+94
-3
lines changed

3 files changed

+94
-3
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed
24+
var copy = require( './../../lib/node_modules/@stdlib/utils/copy' );
25+
26+
// var copy = require( './utils/copy.js' );
27+
var defaults = require( './.eslintrc.typescript.js' );
28+
29+
30+
// MAIN //
31+
32+
/**
33+
* ESLint configuration.
34+
*
35+
* @namespace eslint
36+
*/
37+
var eslint = copy( defaults );
38+
39+
/**
40+
* Disable the rule which requires explicit return types for functions and class methods.
41+
*
42+
* @private
43+
*/
44+
eslint.rules[ '@typescript-eslint/explicit-function-return-type' ] = 'off';
45+
46+
/**
47+
* Disable the rule which disallows the use of variables before they are defined.
48+
*
49+
* @private
50+
*/
51+
eslint.rules[ '@typescript-eslint/no-use-before-define' ] = 'off';
52+
53+
/**
54+
* Disable the rule which enforces consistent brace style for blocks.
55+
*
56+
* @private
57+
*/
58+
eslint.rules[ 'brace-style' ] = 'off';
59+
60+
/**
61+
* Disable the rule which requires that throws statements are documented in JSDoc.
62+
*
63+
* @private
64+
*/
65+
eslint.rules[ 'jsdoc/require-throws' ] = 'off';
66+
67+
/**
68+
* Disable the rule which requires that return statements are documented in JSDoc.
69+
*
70+
* @private
71+
*/
72+
eslint.rules[ 'jsdoc/require-returns' ] = 'off';
73+
74+
/**
75+
* Disable the rule which requires that function parameters are documented in JSDoc.
76+
*
77+
* @private
78+
*/
79+
eslint.rules[ 'jsdoc/require-param' ] = 'off';
80+
81+
82+
// EXPORTS //
83+
84+
module.exports = eslint;

etc/eslint/overrides/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,12 @@ var overrides = [
162162
}
163163
},
164164
{
165-
'files': [ '*.d.ts', '*.ts', '*.tsx' ],
165+
'files': [ '*.d.ts' ],
166166
'extends': resolve( __dirname, '..', '.eslintrc.typescript.js' )
167+
},
168+
{
169+
'files': [ '**/test/*.ts' ],
170+
'extends': resolve( __dirname, '..', '.eslintrc.typescript.tests.js' )
167171
}
168172
];
169173

tools/make/lib/lint/typescript/eslint.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ ESLINT ?= $(BIN_DIR)/eslint
3232
# Define the path to the ESLint configuration file:
3333
ESLINT_TS_CONF ?= $(CONFIG_DIR)/eslint/.eslintrc.typescript.js
3434

35+
# Define the path to the ESLint configuration file for tests:
36+
ESLINT_TS_CONF_TESTS ?= $(CONFIG_DIR)/eslint/.eslintrc.typescript.tests.js
37+
3538
# Define the path to a TypeScript configuration file:
3639
TS_CONFIG ?= $(CONFIG_DIR)/typescript/tsconfig.json
3740

@@ -121,7 +124,7 @@ ifeq ($(FAIL_FAST), true)
121124
DIR=`dirname $$file`; \
122125
LOCAL_TS_CONFIG=$$DIR/tsconfig.json; \
123126
cp $(TS_CONFIG) $$DIR; \
124-
$(ESLINT) $(ESLINT_TS_FLAGS) --config $(ESLINT_TS_CONF) --parser-options=project:$$LOCAL_TS_CONFIG $$file || exit 1; \
127+
$(ESLINT) $(ESLINT_TS_FLAGS) --config $(ESLINT_TS_CONF_TESTS) --parser-options=project:$$LOCAL_TS_CONFIG $$file || exit 1; \
125128
rm $$LOCAL_TS_CONFIG; \
126129
done
127130
else
@@ -131,7 +134,7 @@ else
131134
DIR=`dirname $$file`; \
132135
LOCAL_TS_CONFIG=$$DIR/tsconfig.json; \
133136
cp $(TS_CONFIG) $$DIR; \
134-
$(ESLINT) $(ESLINT_TS_FLAGS) --config $(ESLINT_TS_CONF) --parser-options=project:$$LOCAL_TS_CONFIG $$file || echo 'Linting failed.'; \
137+
$(ESLINT) $(ESLINT_TS_FLAGS) --config $(ESLINT_TS_CONF_TESTS) --parser-options=project:$$LOCAL_TS_CONFIG $$file || echo 'Linting failed.'; \
135138
rm $$LOCAL_TS_CONFIG; \
136139
done
137140
endif

0 commit comments

Comments
 (0)