mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 15:47:55 -05:00
Update jsdocs (#2526)
* Show warnings too when linting * Fix some jsdoc warnings * Cleanup globals * Use recommended jsdoc settings * Fix wrong "false" return parameters
This commit is contained in:
35
.eslintrc
35
.eslintrc
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"extends": ["plugin:jsdoc/recommended"],
|
||||
"env": {
|
||||
"amd": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"mocha": true,
|
||||
"es6": true,
|
||||
"amd": true
|
||||
"node": true,
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"DocumentTouch": true,
|
||||
@@ -28,31 +29,19 @@
|
||||
"no-eval": "error",
|
||||
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
|
||||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
|
||||
"no-restricted-syntax": ["error",
|
||||
{
|
||||
"selector": "CallExpression[callee.name='getComputedStyle']",
|
||||
"message": "Do not use `getComputedStyle`, import and use the `computedStyle` helper"
|
||||
}
|
||||
],
|
||||
"no-undef": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-unused-vars": "error",
|
||||
"quotes": ["error", "single"],
|
||||
"semi": "error",
|
||||
"valid-jsdoc": "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,
|
||||
"no-restricted-syntax": [2,
|
||||
{
|
||||
"selector": "CallExpression[callee.name='getComputedStyle']",
|
||||
"message": "Do not use `getComputedStyle`, import and use the `computedStyle` helper"
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"jsdoc": {
|
||||
"additionalTagNames": {
|
||||
"customTags": ["memberOf", "optionName", "optionProp"]
|
||||
}
|
||||
}
|
||||
"jsdoc/check-tag-names": ["error", { "definedTags": ["memberOf", "optionName", "optionProp"] }],
|
||||
"jsdoc/require-jsdoc": "off"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ gulp.task('eslint', () => {
|
||||
.pipe(eslint({
|
||||
configFile: '.eslintrc'
|
||||
}))
|
||||
.pipe(eslint.format())
|
||||
.pipe(eslint.failOnError());
|
||||
});
|
||||
|
||||
|
||||
@@ -92,11 +92,11 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
|
||||
* @optionProp addTest
|
||||
* @access public
|
||||
* @function addTest
|
||||
* @param {string|Object} feature - The string name of the feature detect, or an
|
||||
* @param {string|object} feature - The string name of the feature detect, or an
|
||||
* object of feature detect names and test
|
||||
* @param {Function|boolean} test - Function returning true if feature is supported,
|
||||
* false if not. Otherwise a boolean representing the results of a feature detection
|
||||
* @returns {Object} the Modernizr object to allow chaining
|
||||
* @returns {object} the Modernizr object to allow chaining
|
||||
* @example
|
||||
*
|
||||
* The most common way of creating your own feature detects is by calling
|
||||
|
||||
@@ -5,7 +5,7 @@ define(function() {
|
||||
* @access private
|
||||
* @function fnBind
|
||||
* @param {Function} fn - a function you want to change `this` reference to
|
||||
* @param {Object} that - the `this` you want to call the function with
|
||||
* @param {object} that - the `this` you want to call the function with
|
||||
* @returns {Function} The wrapped version of the supplied function
|
||||
*/
|
||||
function fnBind(fn, that) {
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['lodash'], function(_) {
|
||||
*
|
||||
* @access private
|
||||
* @function generate
|
||||
* @param {Object} [config] - A configuration object
|
||||
* @param {object} [config] - A configuration object
|
||||
* @param {Array} [config.options] - An array of options to include in the build
|
||||
* @param {Array} [config.feature-detects] - An array of the feature detects to include
|
||||
* @returns {string} A string of the require.js build
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['injectElementWithStyles', 'domToCSS', 'computedStyle'], function(inject
|
||||
*
|
||||
* @access private
|
||||
* @function nativeTestProps
|
||||
* @param {array} props - An array of property names
|
||||
* @param {Array} props - An array of property names
|
||||
* @param {string} value - A string representing the value we want to check via @supports
|
||||
* @returns {boolean|undefined} A boolean when @supports exists, undefined otherwise
|
||||
*/
|
||||
|
||||
@@ -4,11 +4,11 @@ define(function() {
|
||||
* elem.style.WebkitBorderRadius
|
||||
* instead of something like the following (which is technically incorrect):
|
||||
* elem.style.webkitBorderRadius
|
||||
|
||||
*
|
||||
* WebKit ghosts their properties in lowercase but Opera & Moz do not.
|
||||
* Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
|
||||
* erik.eae.net/archives/2008/03/10/21.48.10/
|
||||
|
||||
*
|
||||
* More here: github.com/Modernizr/Modernizr/issues/issue/21
|
||||
*
|
||||
* @access private
|
||||
|
||||
@@ -9,9 +9,9 @@ define(['ModernizrProto', 'testPropsAll', 'cssToDOM', 'atRule'], function(Modern
|
||||
* @access public
|
||||
* @function prefixed
|
||||
* @param {string} prop - String name of the property to test for
|
||||
* @param {Object} [obj] - An object to test for the prefixed properties on
|
||||
* @param {object} [obj] - An object to test for the prefixed properties on
|
||||
* @param {HTMLElement} [elem] - An element used to test specific properties against
|
||||
* @returns {string|false} The string representing the (possibly prefixed) valid
|
||||
* @returns {string|boolean} The string representing the (possibly prefixed) valid
|
||||
* version of the property, or `false` when it is unsupported.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ define(['ModernizrProto', 'prefixed', 'domToCSS'], function(ModernizrProto, pref
|
||||
* @access public
|
||||
* @function prefixedCSS
|
||||
* @param {string} prop - String name of the property to test for
|
||||
* @returns {string|false} The string representing the (possibly prefixed)
|
||||
* @returns {string|boolean} The string representing the (possibly prefixed)
|
||||
* valid version of the property, or `false` when it is unsupported.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ define(['ModernizrProto', 'domPrefixes', 'createElement'], function(ModernizrPro
|
||||
* @function prefixedCSSValue
|
||||
* @param {string} prop - String name of the property to test for
|
||||
* @param {string} value - String value of the non prefixed version of the value you want to test for
|
||||
* @returns {string|false} The string representing the (possibly prefixed)
|
||||
* @returns {string|boolean} The string representing the (possibly prefixed)
|
||||
* valid version of the property, or `false` when it is unsupported.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ define(['ModernizrProto', 'testPropsAll'], function(ModernizrProto, testPropsAll
|
||||
* @param {string} prop - String naming the property to test (either camelCase or kebab-case)
|
||||
* @param {string} [value] - String of the value to test
|
||||
* @param {boolean} [skipValueTest=false] - Whether to skip testing that the value is supported when using non-native detection
|
||||
* @returns {false|string} returns the string version of the property, or false if it is unsupported
|
||||
* @returns {string|boolean} returns the string version of the property, or `false` if it is unsupported
|
||||
* @example
|
||||
*
|
||||
* testAllProps determines whether a given CSS property, in some prefixed form,
|
||||
|
||||
@@ -6,9 +6,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
|
||||
* @returns {false|*} returns false if the prop is unsupported, otherwise the value that is supported
|
||||
* @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 {boolean|*} returns `false` if the prop is unsupported, otherwise the value that is supported
|
||||
*/
|
||||
function testDOMProps(props, obj, elem) {
|
||||
var item;
|
||||
|
||||
@@ -8,11 +8,11 @@ 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
|
||||
* @returns {false|string} returns the string version of the property, or false if it is unsupported
|
||||
* @returns {string|boolean} returns the string version of the property, or `false` if it is unsupported
|
||||
*/
|
||||
function testPropsAll(prop, prefixed, elem, value, skipValueTest) {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
|
||||
* @access public
|
||||
* @function testStyles
|
||||
* @param {string} rule - String representing a css rule
|
||||
* @param {function} callback - A function that is used to test the injected element
|
||||
* @param {Function} callback - A function that is used to test the injected element
|
||||
* @param {number} [nodes] - An integer representing the number of additional nodes you want injected
|
||||
* @param {string[]} [testnames] - An array of strings that are used as ids for the additional nodes
|
||||
* @returns {boolean}
|
||||
|
||||
@@ -6,7 +6,7 @@ define(function() {
|
||||
*
|
||||
* @access private
|
||||
* @function toStringFn
|
||||
* @returns {function} An abstracted toString function
|
||||
* @returns {Function} An abstracted toString function
|
||||
*/
|
||||
var toStringFn = ({}).toString;
|
||||
return toStringFn;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global UAParser */
|
||||
/*global UAParser*/
|
||||
window.caniusecb = function(caniuse) {
|
||||
|
||||
var ua = new UAParser(navigator.userAgent).getResult();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* globals mocha, __coverage__ */
|
||||
/*global __coverage__*/
|
||||
$(document).ready(function() {
|
||||
|
||||
var runner = mocha.run();
|
||||
|
||||
Reference in New Issue
Block a user