Skip to content

Commit 885162e

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into fix-tolocale-string
2 parents 17daba7 + 90b8f5a commit 885162e

File tree

4 files changed

+73
-17
lines changed

4 files changed

+73
-17
lines changed

lib/node_modules/@stdlib/_tools/eslint/rules/require-file-extensions/lib/main.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ function main( context ) {
102102
*/
103103
function validate( node ) {
104104
var requirePath;
105+
var slashIndex;
105106
var filename;
106107
var resolved;
107108
var parts;
@@ -115,6 +116,18 @@ function main( context ) {
115116
dir = dirname( filename );
116117
if ( startsWith( requirePath, '.' ) ) {
117118
requirePath = path.resolve( dir, requirePath );
119+
} else if ( !startsWith( requirePath, '@stdlib' ) ) {
120+
// Allow simple package names without slashes (e.g., 'tape', 'glob'):
121+
if ( !contains( requirePath, '/' ) ) {
122+
return;
123+
}
124+
// Only skip top-level scoped packages ('@scope/pkg'); still enforce extensions on deeper imports like '@scope/pkg/file.js':
125+
if ( startsWith( requirePath, '@' ) ) {
126+
slashIndex = requirePath.indexOf( '/' );
127+
if ( slashIndex > 0 && requirePath.indexOf( '/', slashIndex + 1 ) === -1 ) {
128+
return;
129+
}
130+
}
118131
}
119132
resolved = tryResolve( requirePath, dir );
120133
parts = path.parse( requirePath );

lib/node_modules/@stdlib/_tools/eslint/rules/require-file-extensions/test/fixtures/invalid.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,22 @@ test = {
7676
};
7777
invalid.push( test );
7878

79+
test = {
80+
'code': [
81+
'// MODULES //',
82+
'',
83+
'var parser = require( \'@typescript-eslint/parser/dist/index\' );'
84+
].join( '\n' ),
85+
'errors': [
86+
{
87+
'message': 'require statement of file is missing a file extension. Value: @typescript-eslint/parser/dist/index',
88+
'type': 'CallExpression'
89+
}
90+
],
91+
'filename': resolve( './invalid.js' )
92+
};
93+
invalid.push( test );
94+
7995

8096
// EXPORTS //
8197

lib/node_modules/@stdlib/_tools/eslint/rules/require-file-extensions/test/fixtures/valid.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
// MODULES //
2222

2323
var resolve = require( 'path' ).resolve;
24+
var join = require( 'path' ).join;
25+
var rootDir = require( '@stdlib/_tools/utils/root-dir' );
26+
27+
28+
// VARIABLES //
29+
30+
var ROOT_DIR = rootDir();
2431

2532

2633
// MAIN //
@@ -96,6 +103,26 @@ test = {
96103
};
97104
valid.push( test );
98105

106+
test = {
107+
'code': [
108+
'// MODULES //',
109+
'',
110+
'var parser = require( \'@typescript-eslint/parser\' );'
111+
].join( '\n' ),
112+
'filename': resolve( './valid.js' )
113+
};
114+
valid.push( test );
115+
116+
test = {
117+
'code': [
118+
'// MODULES //',
119+
'',
120+
'var main = require( \'./main.js\' );'
121+
].join( '\n' ),
122+
'filename': join( ROOT_DIR, 'lib/index.js' )
123+
};
124+
valid.push( test );
125+
99126

100127
// EXPORTS //
101128

lib/node_modules/@stdlib/dstructs/named-typed-tuple/test/test.copy_within.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,36 @@
2323
var tape = require( 'tape' );
2424
var hasProp = require( '@stdlib/assert/has-property' );
2525
var isFunction = require( '@stdlib/assert/is-function' );
26-
var namedtypetuple = require( './../lib' );
26+
var namedtypedtuple = require( './../lib' );
2727

2828

2929
// TESTS //
3030

3131
tape( 'main export is a function', function test( t ) {
3232
t.ok( true, __filename );
33-
t.strictEqual( typeof namedtypetuple, 'function', 'main export is a function' );
33+
t.strictEqual( typeof namedtypedtuple, 'function', 'main export is a function' );
3434
t.end();
3535
});
3636

3737
tape( 'a tuple has a `copyWithin` method for copying a sequence of tuple elements within a tuple', function test( t ) {
3838
var Point;
3939
var p;
4040

41-
Point = namedtypetuple( [ 'x', 'y' ] );
41+
Point = namedtypedtuple( [ 'x', 'y' ] );
4242
p = new Point();
4343

44-
t.strictEqual( hasProp( p, 'copyWithin' ), true, 'has property' );
45-
t.strictEqual( isFunction( p.copyWithin ), true, 'has method' );
44+
t.strictEqual( hasProp( p, 'copyWithin' ), true, 'returns expected value' );
45+
t.strictEqual( isFunction( p.copyWithin ), true, 'returns expected value' );
4646
t.end();
4747
});
4848

49-
tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
49+
tape( 'the method throws an error if invoked with a `this` context which is not a tuple instance', function test( t ) {
5050
var values;
5151
var Point;
5252
var p;
5353
var i;
5454

55-
Point = namedtypetuple( [ 'x', 'y' ] );
55+
Point = namedtypedtuple( [ 'x', 'y' ] );
5656
p = new Point();
5757

5858
values = [
@@ -78,13 +78,13 @@ tape( 'the method throws an error if invoked with a `this` context which is not
7878
}
7979
});
8080

81-
tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance (end)', function test( t ) {
81+
tape( 'the method throws an error if invoked with a `this` context which is not a tuple instance (end)', function test( t ) {
8282
var values;
8383
var Point;
8484
var p;
8585
var i;
8686

87-
Point = namedtypetuple( [ 'x', 'y' ] );
87+
Point = namedtypedtuple( [ 'x', 'y' ] );
8888
p = new Point();
8989

9090
values = [
@@ -123,7 +123,7 @@ tape( 'the method copies a sequence of elements within a tuple', function test(
123123
4.0
124124
];
125125

126-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
126+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
127127
p = new Point( arr );
128128

129129
p.copyWithin( 0, 3 );
@@ -153,7 +153,7 @@ tape( 'the method copies a sequence of elements within a tuple (negative target)
153153
4.0
154154
];
155155

156-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
156+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
157157
p = new Point( arr );
158158

159159
p.copyWithin( -p.length, 3 );
@@ -183,7 +183,7 @@ tape( 'the method copies a sequence of elements within a tuple (negative start)'
183183
4.0
184184
];
185185

186-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
186+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
187187
p = new Point( arr );
188188

189189
p.copyWithin( 0, -2 );
@@ -213,7 +213,7 @@ tape( 'the method copies a sequence of elements within a tuple (end=length)', fu
213213
4.0
214214
];
215215

216-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
216+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
217217
p = new Point( arr );
218218

219219
p.copyWithin( 0, 3, p.length );
@@ -243,7 +243,7 @@ tape( 'the method copies a sequence of elements within a tuple (non-inclusive en
243243
4.0
244244
];
245245

246-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
246+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
247247
p = new Point( arr );
248248

249249
p.copyWithin( 2, 0, 2 );
@@ -275,7 +275,7 @@ tape( 'the method copies a sequence of elements within a tuple (negative end)',
275275
4.0
276276
];
277277

278-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
278+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
279279
p = new Point( arr );
280280

281281
p.copyWithin( 2, 0, -3 );
@@ -307,7 +307,7 @@ tape( 'the method copies a sequence of elements within a tuple (target >= length
307307
4.0
308308
];
309309

310-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
310+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
311311
p = new Point( arr );
312312

313313
p.copyWithin( p.length, 3 );
@@ -335,7 +335,7 @@ tape( 'the method copies a sequence of elements within a tuple (target > start)'
335335
4.0
336336
];
337337

338-
Point = namedtypetuple( [ 'x', 'y', 'z', 'w', 'v' ] );
338+
Point = namedtypedtuple( [ 'x', 'y', 'z', 'w', 'v' ] );
339339
p = new Point( arr );
340340

341341
p.copyWithin( 2, 0 );

0 commit comments

Comments
 (0)