Skip to content

Commit 49ec46a

Browse files
committed
test: restore tests for lint rule
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent b15ef90 commit 49ec46a

File tree

10 files changed

+595
-9
lines changed

10 files changed

+595
-9
lines changed

lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/lib/main.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@
2323
var basename = require( 'path' ).basename;
2424
var dirname = require( 'path' ).dirname;
2525
var join = require( 'path' ).join;
26-
var relative = require( 'path' ).relative;
2726
var statSync = require( 'fs' ).statSync; // eslint-disable-line node/no-sync
2827
var exists = require( '@stdlib/fs/exists' ).sync;
2928
var endsWith = require( '@stdlib/string/ends-with' );
30-
var replace = require( '@stdlib/string/replace' );
3129
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3230
var trim = require( '@stdlib/string/trim' );
3331
var camelcase = require( '@stdlib/string/base/camelcase' );
3432
var readDir = require( '@stdlib/fs/read-dir' ).sync;
3533
var contains = require( '@stdlib/assert/contains' );
36-
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
34+
var resolvePackage = require( './resolve_package.js' );
3735

3836

3937
// VARIABLES //
@@ -42,7 +40,6 @@ var rule;
4240
var ORDER_COMMENT = 'When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.';
4341
var RE_CUSTOM_EXCLUDES = /The following modules are intentionally not exported: ?([^\n]+)\n/;
4442
var RE_NS_VAR = /@namespace ([a-zA-Z0-9_]+)/;
45-
var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
4643
var EXCLUDE_LIST = [
4744
'node_modules',
4845
'benchmark',
@@ -185,15 +182,15 @@ function main( context ) {
185182
* @returns {Object} fix
186183
*/
187184
function fix( fixer ) {
188-
var nsPath;
185+
var packagePath;
189186
var entry;
190187
var match;
191188
var pos;
192189
var ns;
193190
var re;
194191
var i;
195192

196-
nsPath = replace( relative( LIB_DIR, dir ), '\\', '/' );
193+
packagePath = resolvePackage( dir, pkg );
197194
match = RE_NS_VAR.exec( source.text );
198195
if ( !match ) {
199196
return null;
@@ -209,7 +206,7 @@ function main( context ) {
209206
'*/',
210207
'setReadOnly( <<ns>>, \'<<alias>>\', require( \'<<pkg>>\' ) );'
211208
].join( '\n' );
212-
entry = entry.replace( /<<pkg>>/g, nsPath + '/' + pkg );
209+
entry = entry.replace( /<<pkg>>/g, packagePath );
213210
entry = entry.replace( /<<alias>>/g, camelcase( pkg ) );
214211
entry = entry.replace( /<<ns>>/g, ns );
215212

@@ -219,7 +216,7 @@ function main( context ) {
219216
if ( pkg.localeCompare( packages[ i ], 'en', OPTS_COMPARE ) < 0 ) {
220217
break;
221218
}
222-
re = new RegExp( 'require\\( \'' + nsPath + '\\/' + packages[ i ] + '\' \\) \\);' );
219+
re = new RegExp( 'require\\( \'' + resolvePackage( dir, packages[ i ] ) + '\' \\) \\);' );
223220
if ( re.test( source.text ) ) {
224221
pos = source.text.search( re );
225222
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
var join = require( 'path' ).join;
24+
var relative = require( 'path' ).relative;
25+
var replace = require( '@stdlib/string/replace' );
26+
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
27+
28+
29+
// VARIABLES //
30+
31+
var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
32+
33+
34+
// MAIN //
35+
36+
/**
37+
* Resolves a stdlib package identifier from directory path and package name.
38+
*
39+
* @private
40+
* @param {string} dir - directory path containing the package
41+
* @param {string} pkg - package name
42+
* @returns {string} stdlib package identifier relative to the lib directory
43+
*
44+
* @example
45+
* var join = require( 'path' ).join;
46+
* var rootDir = require( '@stdlib/_tools/utils/root-dir' );
47+
*
48+
* var LIB_DIR = join( rootDir(), 'lib', 'node_modules' );
49+
* var dir = join( LIB_DIR, '@stdlib', 'math', 'base' );
50+
*
51+
* var pkgId = resolvePackage( dir, 'abs' );
52+
* // returns '@stdlib/math/base/abs'
53+
*/
54+
function resolvePackage( dir, pkg ) {
55+
var nsPath = replace( relative( LIB_DIR, dir ), '\\', '/' );
56+
return nsPath + '/' + pkg;
57+
}
58+
59+
60+
// EXPORTS //
61+
62+
module.exports = resolvePackage;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "@stdlib/assert/is-complex128",
3+
"version": "0.0.0",
4+
"description": "Test if a value is a 128-bit complex number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdassert",
54+
"assertion",
55+
"assert",
56+
"utilities",
57+
"utility",
58+
"utils",
59+
"util",
60+
"is",
61+
"iscomplex",
62+
"complex128",
63+
"128-bit",
64+
"float64",
65+
"double",
66+
"double-precision",
67+
"ieee754",
68+
"type",
69+
"check",
70+
"validate",
71+
"isvalid",
72+
"test"
73+
]
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@stdlib/assert/is-complex64",
3+
"version": "0.0.0",
4+
"description": "Test if a value is a 64-bit complex number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdassert",
54+
"assertion",
55+
"assert",
56+
"utilities",
57+
"utility",
58+
"utils",
59+
"util",
60+
"is",
61+
"iscomplex",
62+
"complex64",
63+
"64-bit",
64+
"float32",
65+
"single",
66+
"single-precision",
67+
"ieee754",
68+
"type",
69+
"check",
70+
"test",
71+
"validate",
72+
"isvalid",
73+
"valid"
74+
]
75+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@stdlib/complex/cmplx",
3+
"version": "0.0.0",
4+
"description": "Create a complex number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"benchmark": "./benchmark",
19+
"doc": "./docs",
20+
"example": "./examples",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdtypes",
54+
"types",
55+
"data",
56+
"structure",
57+
"complex",
58+
"cmplx",
59+
"number",
60+
"complex128",
61+
"complex64"
62+
]
63+
}

0 commit comments

Comments
 (0)