Skip to content

Commit

Permalink
Add parser option ecmaVersion: 2017 to .eslintrc
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed Jul 28, 2021
1 parent 683219d commit b2df431
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"expect": true,
"sinon": true
},
"parserOptions": {
"ecmaVersion": 2017
},
"extends": ["eslint:recommended", "prettier"],
"plugins": ["prettier"],
"rules": {
Expand Down
71 changes: 41 additions & 30 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,17 @@ module.exports = function(grunt) {
images: {
options: {
optimizationLevel: 2,
use: [mozjpeg({quality: 70}), pngquant()] //plugins for jpeg & png image compression
//plugins for jpeg & png image compression
use: [mozjpeg({ quality: 70 }), pngquant()]
},
files: [{
expand: true,
cwd: '<%= config.src %>/assets/img',
src: ['**/*.{png,jpg,gif,svg,ico}'],
dest: '<%= config.dist %>/assets/img/'
}]
files: [
{
expand: true,
cwd: '<%= config.src %>/assets/img',
src: ['**/*.{png,jpg,gif,svg,ico}'],
dest: '<%= config.dist %>/assets/img/'
}
]
}
},

Expand All @@ -191,16 +194,18 @@ module.exports = function(grunt) {
annotation: '<%= config.dist %>/assets/css/maps/'
},
processors: [
require('autoprefixer')({browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]}),
require('autoprefixer')({
browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]
}),
require('cssnano')()
]
},
Expand Down Expand Up @@ -419,41 +424,47 @@ module.exports = function(grunt) {
});
});

grunt.registerTask('json-to-fluent', async function(){
grunt.registerTask('json-to-fluent', async function() {
const done = this.async();
const languages = pkg.languages;
const promises = [];

try{
for(const language of languages){
const fileData = await fs.readFile(`./src/data/reference/${language}.json`);
try {
for (const language of languages) {
const fileData = await fs.readFile(
`./src/data/reference/${language}.json`
);
const ftlStrs = fluentConverter.jsonToFtl(fileData);
fse.mkdirpSync(`./src/data/localization/${language}/`);
_.each(ftlStrs, (str, name) => {
promises.push(fs.writeFile(`./src/data/localization/${language}/${name}.ftl`, str));
promises.push(
fs.writeFile(`./src/data/localization/${language}/${name}.ftl`, str)
);
});
}

await Promise.all(promises);
done();
}catch(err){
} catch (err) {
done(err);
}
});

grunt.registerTask('fluent-to-json', async function(){
grunt.registerTask('fluent-to-json', async function() {
const done = this.async();
const languages = pkg.languages;
const promises = [];

try{
for(const language of languages){
const fileData = await fs.readFile(`./src/data/reference/${language}.json`);
try {
for (const language of languages) {
const fileData = await fs.readFile(
`./src/data/reference/${language}.json`
);
const data = JSON.parse(fileData);
const newData = _.cloneDeep(data);

const files = await glob(`./src/data/localization/${language}/*.ftl`);
for(const file of files) {
for (const file of files) {
if(
file !== `./src/data/localization/${language}/root.ftl`
){
Expand All @@ -462,15 +473,15 @@ module.exports = function(grunt) {
const jsonData = fluentConverter.ftlToObj(fileData);

_.assign(newData[key], jsonData);
}
}
}
}

// Write data out to JSON files
// Will be implemented when confirm there will be no data loss
console.log('File write skipped.');
done();
}catch(err){
} catch (err) {
done(err);
}
});
Expand Down

0 comments on commit b2df431

Please sign in to comment.