Skip to content

Commit ffb7f9e

Browse files
committed
Responding to comments
1 parent 2e53047 commit ffb7f9e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

scripts/addRuleToIndex.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export default function transformer(file, api, options) {
99
} = options || {};
1010

1111
const nameSort = (a, b) => {
12-
const aName = a.key.value;
13-
const bName = b.key.value;
12+
const aName = (a.key.type === 'Literal') ? a.key.value : a.key.name;
13+
const bName = (b.key.type === 'Literal') ? b.key.value : b.key.name;
1414
if (aName < bName) {
1515
return -1;
1616
}

scripts/create-rule.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ fs.writeFileSync(docsPath, docBoilerplate);
3333

3434
// Add the rule to the index
3535
exec([
36-
'./node_modules/jscodeshift/bin/jscodeshift.sh',
36+
path.join(
37+
require.resolve('jscodeshift'),
38+
require('jscodeshift/package.json').bin.jscodeshift
39+
),
3740
'./src/index.js',
3841
'-t ./scripts/addRuleToIndex.js',
39-
'-p',
4042
'--extensions js',
4143
'--parser flow',
4244
`--ruleName=${ruleName}`,
@@ -47,7 +49,5 @@ exec([
4749
console.error(`exec error: ${error}`);
4850
return;
4951
}
50-
console.log(`stdout: ${stdout}`);
51-
console.log(`stderr: ${stderr}`);
5252
}
5353
);

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
'img-has-alt': require('./rules/img-has-alt'),
1818
'img-redundant-alt': require('./rules/img-redundant-alt'),
1919
'label-has-for': require('./rules/label-has-for'),
20-
'lang': require('./rules/lang'),
20+
lang: require('./rules/lang'),
2121
'mouse-events-have-key-events': require('./rules/mouse-events-have-key-events'),
2222
'no-access-key': require('./rules/no-access-key'),
2323
'no-autofocus': require('./rules/no-autofocus'),
@@ -28,7 +28,7 @@ module.exports = {
2828
'onclick-has-role': require('./rules/onclick-has-role'),
2929
'role-has-required-aria-props': require('./rules/role-has-required-aria-props'),
3030
'role-supports-aria-props': require('./rules/role-supports-aria-props'),
31-
'scope': require('./rules/scope'),
31+
scope: require('./rules/scope'),
3232
'tabindex-no-positive': require('./rules/tabindex-no-positive'),
3333
},
3434
configs: {

0 commit comments

Comments
 (0)