mirror of
https://github.com/atom/atom.git
synced 2026-01-21 12:57:55 -05:00
Replace 'use babel' -> '@babel' in comment directive
This commit is contained in:
@@ -3,7 +3,7 @@ fs = require 'fs'
|
||||
BABEL_PREFIXES = [
|
||||
"'use babel'"
|
||||
'"use babel"'
|
||||
'/** use babel */'
|
||||
'/** @babel */'
|
||||
]
|
||||
|
||||
PREFIX_LENGTH = Math.max(BABEL_PREFIXES.map((prefix) -> prefix.length)...)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
describe "Babel transpiler support", ->
|
||||
describe 'when a .js file starts with /** use babel */;', ->
|
||||
describe 'when a .js file starts with /** @babel */;', ->
|
||||
it "transpiles it using babel", ->
|
||||
transpiled = require('./fixtures/babel/babel-comment.js')
|
||||
expect(transpiled(3)).toBe 4
|
||||
|
||||
2
spec/fixtures/babel/babel-comment.js
vendored
2
spec/fixtures/babel/babel-comment.js
vendored
@@ -1,3 +1,3 @@
|
||||
/** use babel */
|
||||
/** @babel */
|
||||
|
||||
module.exports = v => v + 1
|
||||
|
||||
@@ -10,7 +10,7 @@ let babelVersionDirectory = null
|
||||
const defaultOptions = require('../static/babelrc.json')
|
||||
|
||||
exports.shouldCompile = function(sourceCode) {
|
||||
return sourceCode.startsWith('/** use babel */') ||
|
||||
return sourceCode.startsWith('/** @babel */') ||
|
||||
sourceCode.startsWith('"use babel"') ||
|
||||
sourceCode.startsWith("'use babel'")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user