-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update bulk-decaffeinate for decaffeinate 3.0 (#131)
* Add a `--use-js-modules` option that performs the fix-imports step and sets the decaffeinate args to use JS modules. * Update a bunch of tests to reflect the defaults changes. * Make the `--allow-invalid-constructors` option a no-op, since it isn't needed with decaffeinate 3.0. * Update the README example to no longer use `--allow-invalid-constructors`. Also change it from hubot to coffeelint, since hubot is now a JS project. BREAKING CHANGE: The `--allow-invalid-constructors` option is now a no-op.
- Loading branch information
1 parent
b142fcf
commit 42cddf0
Showing
19 changed files
with
104 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ Sample User <[email protected]> Initial commit | |
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
let a = 1; | ||
const a = 1; | ||
`); | ||
await assertFileContents('./B.js', `\ | ||
/* eslint-disable | ||
|
@@ -91,7 +91,7 @@ let a = 1; | |
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
// This is a literate file. | ||
let b = 1; | ||
const b = 1; | ||
`); | ||
await assertFileContents('./C.js', `\ | ||
/* eslint-disable | ||
|
@@ -100,7 +100,7 @@ let b = 1; | |
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
// This is another literate file. | ||
let c = 1; | ||
const c = 1; | ||
`); | ||
}); | ||
}); | ||
|
@@ -114,8 +114,8 @@ let c = 1; | |
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
let nameAfter = 3; | ||
let notChanged = 4; | ||
const nameAfter = 3; | ||
const notChanged = 4; | ||
`); | ||
}); | ||
}); | ||
|
@@ -129,7 +129,14 @@ let notChanged = 4; | |
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
let a = require('./A'); | ||
/* | ||
* decaffeinate suggestions: | ||
* DS102: Remove unnecessary code created because of implicit returns | ||
* DS208: Avoid top-level this | ||
* DS209: Avoid top-level return | ||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md | ||
*/ | ||
const a = require('./A'); | ||
// This is a comment | ||
function f() { | ||
|
@@ -203,7 +210,7 @@ console.log('This is a file'); | |
*/ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Fix any style issues and re-enable lint. | ||
let a = require('b'); | ||
const a = require('b'); | ||
module.exports = c; | ||
`); | ||
}); | ||
|
@@ -372,17 +379,4 @@ Proceeding anyway.`); | |
assert.equal((await exec('git rev-list --count HEAD'))[0].trim(), '4'); | ||
}); | ||
}); | ||
|
||
it('allows invalid constructors when specified', async function() { | ||
await runWithTemplateDir('invalid-subclass-constructor', async function() { | ||
await runCliExpectSuccess('convert --allow-invalid-constructors'); | ||
}); | ||
}); | ||
|
||
it('does not allow invalid constructors when not specified', async function() { | ||
await runWithTemplateDir('invalid-subclass-constructor', async function() { | ||
let message = await runCliExpectError('convert'); | ||
assertIncludes(message, 'Some files could not be converted with decaffeinate'); | ||
}); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
test/examples/fix-imports-absolute-imports/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
test/examples/fix-imports-default-import-to-import-star/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
decaffeinateArgs: ['--loose-js-modules'], | ||
}; |
4 changes: 1 addition & 3 deletions
4
test/examples/fix-imports-destructure-from-import-star/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
decaffeinateArgs: ['--loose-js-modules'], | ||
}; |
5 changes: 0 additions & 5 deletions
5
test/examples/fix-imports-export-function/bulk-decaffeinate.config.js
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
test/examples/fix-imports-import-commonjs/bulk-decaffeinate.config.js
This file was deleted.
Oops, something went wrong.
4 changes: 1 addition & 3 deletions
4
test/examples/fix-imports-import-from-existing-js/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
decaffeinateArgs: ['--loose-js-modules'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
test/examples/fix-imports-named-import-to-destructure/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
decaffeinateArgs: ['--loose-js-modules'], | ||
}; |
5 changes: 0 additions & 5 deletions
5
test/examples/fix-imports-no-name-usages/bulk-decaffeinate.config.js
This file was deleted.
Oops, something went wrong.
4 changes: 1 addition & 3 deletions
4
test/examples/fix-imports-non-relative-path/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
decaffeinateArgs: ['--loose-js-modules'], | ||
}; |
5 changes: 0 additions & 5 deletions
5
test/examples/fix-imports-star-import-from-existing-js/bulk-decaffeinate.config.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.