Skip to content

Commit

Permalink
Update eslint (#2304)
Browse files Browse the repository at this point in the history
* html5shiv files are excluded in grunt task already

* Fix some indendation errors

* Remove orphaned jshint files

* Use eslint-plugin-jsdoc for jsdoc

* Update eslint, remove incompatible google preset

* Update eslint-plugin-jsdoc, fix some new warnings
  • Loading branch information
rejas committed May 23, 2018
1 parent 7459017 commit 1956f0b
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 89 deletions.
32 changes: 11 additions & 21 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
{
"preset": "google",
"jsDoc": {
"requireHyphenBeforeDescription": true,
"requireNewlineAfterDescription": true,
"checkRedundantReturns": true,
"checkParamExistence": true,
"requireReturnTypes": true,
"requireParamTypes": true,
"checkReturnTypes": true,
"checkTypes": true,
"checkAnnotations": {
"preset": "jsdoc3",
"extra": {
"access": true,
"optionName": true,
"optionProp": true,
"memberof": true
}
}
},
"env": {
"browser": true,
"node": true,
Expand All @@ -34,6 +14,9 @@
"$": true,
"_": true
},
"plugins": [
"jsdoc"
],
"rules": {
"indent": [
2,
Expand Down Expand Up @@ -66,6 +49,13 @@
],
"dot-notation": "off",
"valid-jsdoc": "error",
"no-global-getComputedStyle": "error"
"no-global-getComputedStyle": "error",
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/require-hyphen-before-param-description": 1,
"jsdoc/require-param": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-type": 1
}
}
2 changes: 0 additions & 2 deletions .jshintignore

This file was deleted.

4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ module.exports = function(grunt) {
'lib/*.js',
'test/**/*.js',
'feature-detects/**/*.js',
'!src/html5shiv.js',
'!src/html5printshiv.js',
'!test/coverage/**/*.js',
'!test/js/lib/**/*.js',
'!src/html5shiv.js'
'!test/js/lib/**/*.js'
],
options: {
rulePaths: ['test/eslint/rules']
Expand Down
14 changes: 7 additions & 7 deletions feature-detects/css/subpixelfont.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
*/
testStyles(
'#modernizr{position: absolute; top: -10em; visibility:hidden; font: normal 10px arial;}#subpixel{float: left; font-size: 33.3333%;}',
function(elem) {
var subpixel = elem.firstChild;
subpixel.innerHTML = 'This is a text written in Arial';
Modernizr.addTest('subpixelfont', window.getComputedStyle ?
window.getComputedStyle(subpixel, null).getPropertyValue('width') !== '44px'
: false);
}, 1, ['subpixel']);
function(elem) {
var subpixel = elem.firstChild;
subpixel.innerHTML = 'This is a text written in Arial';
Modernizr.addTest('subpixelfont', window.getComputedStyle ?
window.getComputedStyle(subpixel, null).getPropertyValue('width') !== '44px'
: false);
}, 1, ['subpixel']);
});
2 changes: 1 addition & 1 deletion feature-detects/forcetouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Force Touch events are available in OS X 10.11 and later on devices equipped wit
*/
define(['Modernizr', 'hasEvent', 'prefixed'], function(Modernizr, hasEvent, prefixed) {
Modernizr.addTest('forcetouch', function() {
// github.com/Modernizr/Modernizr/issues/1613
// github.com/Modernizr/Modernizr/issues/1613
// Test if the browser supports the force touch event progression (see notes link)
if (!hasEvent(prefixed('mouseforcewillbegin', window, false), window)) {
return false;
Expand Down
14 changes: 0 additions & 14 deletions lib/.jshintrc

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
},
"devDependencies": {
"@alrra/travis-scripts": "^3.0.1",
"eslint": "^4.19.1",
"eslint-plugin-jsdoc": "^3.6.3",
"expect.js": "^0.3.1",
"grunt": "^1.0.2",
"grunt-contrib-clean": "^1.1.0",
Expand All @@ -25,7 +27,7 @@
"grunt-contrib-pug": "^1.0.0",
"grunt-coveralls": "^2.0.0",
"grunt-env": "^0.4.4",
"grunt-eslint": "^18.1.0",
"grunt-eslint": "^20.1.0",
"grunt-istanbul": "^0.8.0",
"grunt-mocha": "^0.4.15",
"grunt-mocha-test": "^0.12.7",
Expand Down
2 changes: 1 addition & 1 deletion src/addTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(ModernizrProto, Modernizr, hasOwnProp, setClasses) {

// _l tracks listeners for async tests, as well as tests that execute after the initial run
// _l tracks listeners for async tests, as well as tests that execute after the initial run
ModernizrProto._l = {};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/mq.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i

injectElementWithStyles('@media ' + mq + ' { #modernizr { position: absolute; } }', function(node) {
bool = (window.getComputedStyle ?
window.getComputedStyle(node, null) :
node.currentStyle).position == 'absolute';
window.getComputedStyle(node, null) :
node.currentStyle).position == 'absolute';
});

return bool;
Expand Down
6 changes: 3 additions & 3 deletions src/testDOMProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ define(['is', 'fnBind'], function(is, fnBind) {
*
* @access private
* @function testDOMProps
* @param {array.<string>} props - An array of properties to test for
* @param {object} obj - An object or Element you want to use to test the parameters again
* @param {boolean|object} elem - An Element to bind the property lookup again. Use `false` to prevent the check
* @param {Array<string>} props - An array of properties to test for
* @param {Object} obj - An object or Element you want to use to test the parameters again
* @param {boolean|Object} elem - An Element to bind the property lookup again. Use `false` to prevent the check
* @returns {false|*} returns false if the prop is unsupported, otherwise the value that is supported
*/
function testDOMProps(props, obj, elem) {
Expand Down
2 changes: 1 addition & 1 deletion src/testPropsAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define(['ModernizrProto', 'cssomPrefixes', 'is', 'testProps', 'domPrefixes', 'te
* @access private
* @function testPropsAll
* @param {string} prop - A string of the property to test for
* @param {string|object} [prefixed] - An object to check the prefixed properties on. Use a string to skip
* @param {string|Object} [prefixed] - An object to check the prefixed properties on. Use a string to skip
* @param {HTMLElement|SVGElement} [elem] - An element used to test the property and value against
* @param {string} [value] - A string of a css value
* @param {boolean} [skipValueTest] - An boolean representing if you want to test if value sticks when set
Expand Down
15 changes: 0 additions & 15 deletions test/.jshintrc

This file was deleted.

38 changes: 19 additions & 19 deletions test/node/lib/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,31 +173,31 @@ describe('cli/metadata', function() {
deps: Joi.array().items(Joi.string()),

notes: Joi.array().items(
Joi.object().keys({
name: Joi.string().required(),
href: Joi.string().required()
})
).unique(),
Joi.object().keys({
name: Joi.string().required(),
href: Joi.string().required()
})
).unique(),

cssclass: Joi.alternatives().try(
Joi.string().lowercase(),
Joi.array().items(Joi.string().lowercase())
).required(),
Joi.string().lowercase(),
Joi.array().items(Joi.string().lowercase())
).required(),

property: Joi.alternatives().try(
Joi.string().lowercase(),
Joi.array().items(Joi.string().lowercase())
).required(),
Joi.string().lowercase(),
Joi.array().items(Joi.string().lowercase())
).required(),

polyfills: Joi.array().items(
Joi.object().keys({
name: Joi.string().required(),
authors: Joi.array().items(Joi.string()),
notes: Joi.array().items(Joi.string()),
href: Joi.string().required(),
licenses: Joi.array().items(Joi.string()).required()
})
).unique()
Joi.object().keys({
name: Joi.string().required(),
authors: Joi.array().items(Joi.string()),
notes: Joi.array().items(Joi.string()),
href: Joi.string().required(),
licenses: Joi.array().items(Joi.string()).required()
})
).unique()
});

metadata(function(data) {
Expand Down

0 comments on commit 1956f0b

Please sign in to comment.