Skip to content

Add ECMAScript version to Falafel/Acorn.js config #7501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/find_locale_strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function findLocaleStrings() {
var code = fs.readFileSync(file, 'utf-8');
var filePartialPath = file.substr(constants.pathToSrc.length);

falafel(code, {locations: true}, function(node) {
falafel(code, { ecmaVersion: 'latest', locations: true }, function(node) {
if(node.type === 'CallExpression' &&
(node.callee.name === '_' || node.callee.source() === 'Lib._')
) {
Expand Down
2 changes: 1 addition & 1 deletion tasks/shard_jasmine_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ glob(path.join(pathToJasmineTests, '*.js')).then((files) => {
var code = fs.readFileSync(file, 'utf-8');
var bn = path.basename(file);

falafel(code, function(node) {
falafel(code, { ecmaVersion: 'latest' }, function(node) {
if(isJasmineTestIt(node, tag)) {
if(file2cnt[bn]) {
file2cnt[bn]++;
Expand Down
4 changes: 2 additions & 2 deletions tasks/test_syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function assertJasmineSuites() {
var code = fs.readFileSync(file, 'utf-8');
var bn = path.basename(file);

falafel(code, {locations: true}, function(node) {
falafel(code, { ecmaVersion: 'latest', locations: true }, function(node) {
var lineInfo = '[line ' + node.loc.start.line + '] :';

if(node.type === 'Identifier' && BLACK_LIST.indexOf(node.name) !== -1) {
Expand Down Expand Up @@ -108,7 +108,7 @@ function assertSrcContents() {

// parse through code string while keeping track of comments
var comments = [];
falafel(code, {onComment: comments, locations: true}, function(node) {
falafel(code, { ecmaVersion: 'latest', locations: true, onComment: comments }, function(node) {
// look for .classList
if(node.type === 'MemberExpression') {
var source = node.source();
Expand Down
2 changes: 1 addition & 1 deletion tasks/util/update_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var pkg = require('../../package.json');

module.exports = function updateVersion(pathToFile) {
fs.readFile(pathToFile, 'utf-8', function(err, code) {
var out = falafel(code, function(node) {
var out = falafel(code, { ecmaVersion: 'latest' }, function(node) {
if(isVersionNode(node)) node.update('\'' + pkg.version + '\'');
});

Expand Down