Skip to content

Commit e534a91

Browse files
committed
Upgrade prettier to v2
Prettier v2 has the following breaking changes: * enforces spaces between `function` and params * enforces trailing commas by default
1 parent f6ff3bf commit e534a91

File tree

104 files changed

+1868
-1893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1868
-1893
lines changed

.eslintrc.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module.exports = {
22
extends: ['eslint:recommended', 'plugin:compat/recommended', 'prettier'],
33
globals: {
4-
self: false
4+
self: false,
55
},
66
env: {
77
node: true,
8-
es2020: true
8+
es2020: true,
99
},
1010
parserOptions: {
11-
sourceType: 'module'
11+
sourceType: 'module',
1212
},
1313
rules: {
1414
'no-console': 'warn',
@@ -59,6 +59,6 @@ module.exports = {
5959

6060
// ECMAScript 6 //
6161
//--------------//
62-
'no-var': 'error'
63-
}
62+
'no-var': 'error',
63+
},
6464
};

Gruntfile.js

+45-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-process-env */
2-
module.exports = function(grunt) {
2+
module.exports = function (grunt) {
33
grunt.initConfig({
44
pkg: grunt.file.readJSON('package.json'),
55

@@ -8,76 +8,81 @@ module.exports = function(grunt) {
88
copy: {
99
dist: {
1010
options: {
11-
processContent: function(content) {
11+
processContent: function (content) {
1212
return (
1313
grunt.template.process(
1414
'/**!\n\n @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n'
1515
) +
1616
content +
1717
'\n// @license-end\n'
1818
);
19-
}
19+
},
2020
},
21-
files: [{ expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/' }]
21+
files: [{ expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/' }],
2222
},
2323
components: {
2424
files: [
2525
{
2626
expand: true,
2727
cwd: 'components/',
2828
src: ['**'],
29-
dest: 'dist/components'
29+
dest: 'dist/components',
30+
},
31+
{
32+
expand: true,
33+
cwd: 'dist/',
34+
src: ['*.js'],
35+
dest: 'dist/components',
3036
},
31-
{ expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/components' }
32-
]
33-
}
37+
],
38+
},
3439
},
3540

3641
babel: {
3742
options: {
3843
sourceMaps: 'inline',
3944
loose: ['es6.modules'],
40-
auxiliaryCommentBefore: 'istanbul ignore next'
45+
auxiliaryCommentBefore: 'istanbul ignore next',
4146
},
4247
cjs: {
4348
files: [
4449
{
4550
cwd: 'lib/',
4651
expand: true,
4752
src: '**/!(index).js',
48-
dest: 'dist/cjs/'
49-
}
50-
]
51-
}
53+
dest: 'dist/cjs/',
54+
},
55+
],
56+
},
5257
},
5358
webpack: {
5459
options: {
5560
context: __dirname,
5661
output: {
5762
path: 'dist/',
5863
library: 'Handlebars',
59-
libraryTarget: 'umd'
60-
}
64+
libraryTarget: 'umd',
65+
},
6166
},
6267
handlebars: {
6368
entry: './dist/cjs/handlebars.js',
6469
output: {
65-
filename: 'handlebars.js'
66-
}
70+
filename: 'handlebars.js',
71+
},
6772
},
6873
runtime: {
6974
entry: './dist/cjs/handlebars.runtime.js',
7075
output: {
71-
filename: 'handlebars.runtime.js'
72-
}
73-
}
76+
filename: 'handlebars.runtime.js',
77+
},
78+
},
7479
},
7580

7681
uglify: {
7782
options: {
7883
mangle: true,
7984
compress: true,
80-
preserveComments: /(?:^!|@(?:license|preserve|cc_on))/
85+
preserveComments: /(?:^!|@(?:license|preserve|cc_on))/,
8186
},
8287
dist: {
8388
files: [
@@ -86,47 +91,47 @@ module.exports = function(grunt) {
8691
expand: true,
8792
src: ['handlebars*.js', '!*.min.js'],
8893
dest: 'dist/',
89-
rename: function(dest, src) {
94+
rename: function (dest, src) {
9095
return dest + src.replace(/\.js$/, '.min.js');
91-
}
92-
}
93-
]
94-
}
96+
},
97+
},
98+
],
99+
},
95100
},
96101

97102
concat: {
98103
tests: {
99104
src: ['spec/!(require).js'],
100-
dest: 'tmp/tests.js'
101-
}
105+
dest: 'tmp/tests.js',
106+
},
102107
},
103108

104109
connect: {
105110
server: {
106111
options: {
107112
base: '.',
108113
hostname: '*',
109-
port: 9999
110-
}
111-
}
114+
port: 9999,
115+
},
116+
},
112117
},
113118

114119
shell: {
115120
integrationTests: {
116-
command: './tests/integration/run-integration-tests.sh'
117-
}
121+
command: './tests/integration/run-integration-tests.sh',
122+
},
118123
},
119124

120125
watch: {
121126
scripts: {
122127
options: {
123-
atBegin: true
128+
atBegin: true,
124129
},
125130

126131
files: ['src/*', 'lib/**/*.js', 'spec/**/*.js'],
127-
tasks: ['on-file-change']
128-
}
129-
}
132+
tasks: ['on-file-change'],
133+
},
134+
},
130135
});
131136

132137
// Load tasks from npm
@@ -148,15 +153,15 @@ module.exports = function(grunt) {
148153
'uglify',
149154
'test:min',
150155
'copy:dist',
151-
'copy:components'
156+
'copy:components',
152157
]);
153158

154159
// Requires secret properties from .travis.yaml
155160
grunt.registerTask('extensive-tests-and-publish-to-aws', [
156161
'default',
157162
'shell:integrationTests',
158163
'metrics',
159-
'publish-to-aws'
164+
'publish-to-aws',
160165
]);
161166

162167
grunt.registerTask('on-file-change', ['build', 'concat:tests', 'test']);
@@ -174,6 +179,6 @@ module.exports = function(grunt) {
174179
);
175180
grunt.registerTask('integration-tests', [
176181
'default',
177-
'shell:integrationTests'
182+
'shell:integrationTests',
178183
]);
179184
};

bin/handlebars.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,103 +5,103 @@ const yargs = require('yargs')
55
.option('f', {
66
type: 'string',
77
description: 'Output File',
8-
alias: 'output'
8+
alias: 'output',
99
})
1010
.option('map', {
1111
type: 'string',
12-
description: 'Source Map File'
12+
description: 'Source Map File',
1313
})
1414
.option('a', {
1515
type: 'boolean',
1616
description: 'Exports amd style (require.js)',
17-
alias: 'amd'
17+
alias: 'amd',
1818
})
1919
.option('c', {
2020
type: 'string',
2121
description: 'Exports CommonJS style, path to Handlebars module',
2222
alias: 'commonjs',
23-
default: null
23+
default: null,
2424
})
2525
.option('h', {
2626
type: 'string',
2727
description: 'Path to handlebar.js (only valid for amd-style)',
2828
alias: 'handlebarPath',
29-
default: ''
29+
default: '',
3030
})
3131
.option('k', {
3232
type: 'string',
3333
description: 'Known helpers',
34-
alias: 'known'
34+
alias: 'known',
3535
})
3636
.option('o', {
3737
type: 'boolean',
3838
description: 'Known helpers only',
39-
alias: 'knownOnly'
39+
alias: 'knownOnly',
4040
})
4141
.option('m', {
4242
type: 'boolean',
4343
description: 'Minimize output',
44-
alias: 'min'
44+
alias: 'min',
4545
})
4646
.option('n', {
4747
type: 'string',
4848
description: 'Template namespace',
4949
alias: 'namespace',
50-
default: 'Handlebars.templates'
50+
default: 'Handlebars.templates',
5151
})
5252
.option('s', {
5353
type: 'boolean',
5454
description: 'Output template function only.',
55-
alias: 'simple'
55+
alias: 'simple',
5656
})
5757
.option('N', {
5858
type: 'string',
5959
description:
6060
'Name of passed string templates. Optional if running in a simple mode. Required when operating on multiple templates.',
61-
alias: 'name'
61+
alias: 'name',
6262
})
6363
.option('i', {
6464
type: 'string',
6565
description:
6666
'Generates a template from the passed CLI argument.\n"-" is treated as a special value and causes stdin to be read for the template value.',
67-
alias: 'string'
67+
alias: 'string',
6868
})
6969
.option('r', {
7070
type: 'string',
7171
description:
7272
'Template root. Base value that will be stripped from template names.',
73-
alias: 'root'
73+
alias: 'root',
7474
})
7575
.option('p', {
7676
type: 'boolean',
7777
description: 'Compiling a partial template',
78-
alias: 'partial'
78+
alias: 'partial',
7979
})
8080
.option('d', {
8181
type: 'boolean',
8282
description: 'Include data when compiling',
83-
alias: 'data'
83+
alias: 'data',
8484
})
8585
.option('e', {
8686
type: 'string',
8787
description: 'Template extension.',
8888
alias: 'extension',
89-
default: 'handlebars'
89+
default: 'handlebars',
9090
})
9191
.option('b', {
9292
type: 'boolean',
9393
description:
9494
'Removes the BOM (Byte Order Mark) from the beginning of the templates.',
95-
alias: 'bom'
95+
alias: 'bom',
9696
})
9797
.option('v', {
9898
type: 'boolean',
9999
description: 'Prints the current compiler version',
100-
alias: 'version'
100+
alias: 'version',
101101
})
102102
.option('help', {
103103
type: 'boolean',
104-
description: 'Outputs this message'
104+
description: 'Outputs this message',
105105
})
106106
.wrap(120);
107107

@@ -110,7 +110,7 @@ argv.files = argv._;
110110
delete argv._;
111111

112112
const Precompiler = require('../dist/cjs/precompiler');
113-
Precompiler.loadTemplates(argv, function(err, opts) {
113+
Precompiler.loadTemplates(argv, function (err, opts) {
114114
if (err) {
115115
throw err;
116116
}

lib/.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
module.exports = {
33
env: {
44
// Handlebars should run natively in the browser
5-
node: false
6-
}
5+
node: false,
6+
},
77
};

lib/handlebars.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
parser as Parser,
33
parse,
44
parseWithoutProcessing,
5-
Visitor
5+
Visitor,
66
} from '@handlebars/parser';
77

88
import runtime from './handlebars.runtime';
@@ -18,10 +18,10 @@ let _create = runtime.create;
1818
function create() {
1919
let hb = _create();
2020

21-
hb.compile = function(input, options) {
21+
hb.compile = function (input, options) {
2222
return compile(input, options, hb);
2323
};
24-
hb.precompile = function(input, options) {
24+
hb.precompile = function (input, options) {
2525
return precompile(input, options, hb);
2626
};
2727

lib/handlebars.runtime.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function create() {
2020
hb.escapeExpression = Utils.escapeExpression;
2121

2222
hb.VM = runtime;
23-
hb.template = function(spec) {
23+
hb.template = function (spec) {
2424
return runtime.template(spec, hb);
2525
};
2626

0 commit comments

Comments
 (0)