2020-06-12 22:13:31 +00:00
|
|
|
|
/* eslint-env node, es6 */
|
2015-05-02 03:31:16 +00:00
|
|
|
|
module.exports = function ( grunt ) {
|
2017-01-23 13:40:14 +00:00
|
|
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
|
|
2016-11-18 21:16:43 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
2016-11-18 21:16:43 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2016-10-05 00:11:41 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
|
|
|
|
|
grunt.initConfig( {
|
2016-11-18 21:16:43 +00:00
|
|
|
|
eslint: {
|
2019-02-06 01:42:53 +00:00
|
|
|
|
options: {
|
2020-06-12 22:13:31 +00:00
|
|
|
|
cache: true,
|
|
|
|
|
fix: grunt.option( 'fix' )
|
2019-02-06 01:42:53 +00:00
|
|
|
|
},
|
2019-05-06 22:43:55 +00:00
|
|
|
|
all: [
|
2019-11-15 17:26:44 +00:00
|
|
|
|
'**/*.{js,json}',
|
2019-05-06 22:43:55 +00:00
|
|
|
|
'!{tests/externals,docs}/**',
|
|
|
|
|
'!{vendor,node_modules}/**'
|
2015-10-31 12:35:06 +00:00
|
|
|
|
]
|
2015-05-02 03:31:16 +00:00
|
|
|
|
},
|
2016-10-05 00:11:41 +00:00
|
|
|
|
// Lint – Styling
|
|
|
|
|
stylelint: {
|
|
|
|
|
options: {
|
|
|
|
|
syntax: 'less'
|
|
|
|
|
},
|
|
|
|
|
all: [
|
2019-11-15 17:26:44 +00:00
|
|
|
|
'modules/**/*.{css,less}'
|
2016-10-05 00:11:41 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
2021-02-01 20:55:54 +00:00
|
|
|
|
// eslint-disable-next-line es/no-object-assign, compat/compat
|
2019-11-15 17:26:44 +00:00
|
|
|
|
banana: Object.assign( {
|
|
|
|
|
options: { requireLowerCase: false }
|
|
|
|
|
}, conf.MessagesDirs ),
|
2015-05-02 03:31:16 +00:00
|
|
|
|
watch: {
|
|
|
|
|
files: [
|
2017-08-19 07:44:03 +00:00
|
|
|
|
'.{stylelintrc,eslintrc}.json',
|
2016-11-18 21:16:43 +00:00
|
|
|
|
'<%= eslint.all %>',
|
|
|
|
|
'<%= stylelint.all %>'
|
2015-05-02 03:31:16 +00:00
|
|
|
|
],
|
|
|
|
|
tasks: 'test'
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
|
2019-05-06 22:43:55 +00:00
|
|
|
|
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana' ] );
|
2018-05-15 07:35:27 +00:00
|
|
|
|
grunt.registerTask( 'test', 'lint' );
|
2021-05-17 23:26:02 +00:00
|
|
|
|
grunt.registerTask( 'default', [ 'test' ] );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
};
|