Skip to content

Commit 1ef57ea

Browse files
committed
Convert from auto-fixing to use suggestions
1 parent 336bbee commit 1ef57ea

File tree

2 files changed

+9
-98
lines changed
  • lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all

2 files changed

+9
-98
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ function main( context ) {
165165
context.report({
166166
'node': node,
167167
'message': msg,
168-
'fix': fix
168+
'suggest': [
169+
{
170+
'desc': 'Add `' + pkg + '` to the namespace `index.js`',
171+
'fix': fix
172+
}
173+
]
169174
});
170175

171176
/**
@@ -276,7 +281,7 @@ rule = {
276281
'description': 'enforce that a namespace `index.js` exports all packages in the respective namespace directory'
277282
},
278283
'schema': [],
279-
'fixable': 'code'
284+
'hasSuggestions': true
280285
},
281286
'create': main
282287
};

lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/invalid.js

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,7 @@ test = {
6363
'type': null
6464
}
6565
],
66-
'filename': join( __dirname, 'error', 'lib', 'index.js' ),
67-
'output': [
68-
'/*',
69-
'* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.',
70-
'*/',
71-
'',
72-
'// MODULES //',
73-
'',
74-
'var setReadOnly = require( \'@stdlib/utils/define-read-only-property\' );',
75-
'',
76-
'',
77-
'// MAIN //',
78-
'',
79-
'/**',
80-
'* Top-level namespace.',
81-
'*',
82-
'* @namespace ns',
83-
'*/',
84-
'var ns = {};',
85-
'',
86-
'/**',
87-
'* @name reviver',
88-
'* @memberof ns',
89-
'* @readonly',
90-
'* @type {Function}',
91-
'* @see {@link module:@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/error/reviver}',
92-
'*/',
93-
'setReadOnly( ns, \'reviver\', require( \'@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/error/reviver\' ) );',
94-
'',
95-
'/**',
96-
'* @name error2json',
97-
'* @memberof ns',
98-
'* @readonly',
99-
'* @type {Function}',
100-
'* @see {@link module:@stdlib/error/to-json}',
101-
'*/',
102-
'setReadOnly( ns, \'error2json\', require( \'@stdlib/error/to-json\' ) );'
103-
].join( '\n' )
66+
'filename': join( __dirname, 'error', 'lib', 'index.js' )
10467
};
10568
invalid.push( test );
10669

@@ -159,64 +122,7 @@ test = {
159122
'type': null
160123
}
161124
],
162-
'filename': join( __dirname, 'complex', 'lib', 'index.js' ),
163-
'output': [
164-
'\'use strict\';',
165-
'',
166-
'/*',
167-
'* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.',
168-
'*/',
169-
'',
170-
'// MODULES //',
171-
'',
172-
'var setReadOnly = require( \'@stdlib/utils/define-read-only-property\' );',
173-
'',
174-
'',
175-
'// MAIN //',
176-
'',
177-
'/**',
178-
'* Top-level namespace.',
179-
'*',
180-
'* @namespace ns',
181-
'*/',
182-
'var ns = {};',
183-
'',
184-
'/**',
185-
'* @name conj',
186-
'* @memberof ns',
187-
'* @readonly',
188-
'* @type {Function}',
189-
'* @see {@link module:@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/complex/conj}',
190-
'*/',
191-
'setReadOnly( ns, \'conj\', require( \'@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/complex/conj\' ) );',
192-
'',
193-
'/**',
194-
'* @name complex',
195-
'* @memberof ns',
196-
'* @readonly',
197-
'* @type {Function}',
198-
'* @see {@link module:@stdlib/complex/cmplx}',
199-
'*/',
200-
'setReadOnly( ns, \'complex\', require( \'@stdlib/complex/cmplx\' ) );',
201-
'',
202-
'/**',
203-
'* @name Complex128',
204-
'* @memberof ns',
205-
'* @readonly',
206-
'* @constructor',
207-
'* @see {@link module:@stdlib/complex/float64}',
208-
'*/',
209-
'setReadOnly( ns, \'Complex128\', require( \'@stdlib/complex/float64\' ) );',
210-
'',
211-
'/**',
212-
'* @name Complex64',
213-
'* @memberof ns',
214-
'* @readonly',
215-
'* @constructor',
216-
'* @see {@link module:@stdlib/complex/float32}',
217-
'*/',
218-
'setReadOnly( ns, \'Complex64\', require( \'@stdlib/complex/float32\' ) );'
219-
].join( '\n' )
125+
'filename': join( __dirname, 'complex', 'lib', 'index.js' )
220126
};
221127
invalid.push( test );
222128

0 commit comments

Comments
 (0)