-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit changes the parser from esprima (the default parser that comes with recast) to @babel/parser. It uses the pre-configured Babel parser shipped with recast (recast/parsers/babel) that ensures the AST returned by Babel is compatible with recast. The goal of this change is to support newer JavaScript syntax that is not yet supported by Esprima, so this commit also includes a new test where the input source includes class syntax, class fields, and a decorator. I also replaced jshint with eslint, based on the current ember-cli configuration, but adjusted the rules to be looser to avoid noise in the diff. We can tighten up the rules and update the source in a separate change. This also adds a prettier config pulled from ember-cli, but does not enforce the rules in the test suite at this time (again, to avoid a noisy diff making it hard to understand the Babel/Esprima parser change).
- Loading branch information
Showing
12 changed files
with
1,781 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/tests/fixtures/ |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
plugins: ['mocha', 'node'], | ||
extends: ['eslint:recommended', 'plugin:node/recommended', 'prettier'], | ||
env: { | ||
browser: false, | ||
node: true, | ||
es6: true, | ||
}, | ||
globals: {}, | ||
rules: { | ||
/*** For compatibility with existing source */ | ||
'no-var': 0, | ||
'no-undef': 0, | ||
'strict': 0, | ||
'object-shorthand': 0, | ||
'no-lonely-if': 0, | ||
|
||
/*** Possible Errors ***/ | ||
|
||
'no-console': 0, | ||
'no-template-curly-in-string': 2, | ||
'no-unsafe-negation': 2, | ||
|
||
/*** Best Practices ***/ | ||
|
||
curly: 2, | ||
eqeqeq: 2, | ||
'guard-for-in': 0, | ||
'no-caller': 2, | ||
'no-eq-null': 2, | ||
'no-eval': 2, | ||
'no-new': 0, | ||
'no-unused-expressions': [ | ||
2, | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
}, | ||
], | ||
'wrap-iife': 0, | ||
yoda: 2, | ||
|
||
/*** Variables ***/ | ||
|
||
'no-unused-vars': 2, | ||
'no-use-before-define': [2, 'nofunc'], | ||
|
||
/*** Stylistic Issues ***/ | ||
|
||
camelcase: 2, | ||
'new-cap': [2, { properties: false }], | ||
'no-array-constructor': 2, | ||
'no-bitwise': 2, | ||
'no-plusplus': 0, | ||
'no-unneeded-ternary': 2, | ||
|
||
/*** ECMAScript 6 ***/ | ||
|
||
'no-useless-computed-key': 2, | ||
'prefer-template': 2, | ||
'symbol-description': 2, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
printWidth: 120, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AppRouter extends Router { | ||
@tracked location = config.locationType; | ||
rootURL = config.rootURL; | ||
} | ||
|
||
Router.map(function() { | ||
this.route('foos'); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AppRouter extends Router { | ||
@tracked location = config.locationType; | ||
rootURL = config.rootURL; | ||
} | ||
|
||
Router.map(function() { | ||
}); |
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 |
---|---|---|
@@ -1 +1 @@ | ||
require('mocha-jshint')(); | ||
require('mocha-eslint')(['lib', 'index.js', 'tests/*.js', 'tests/helpers']); |
Oops, something went wrong.