Skip to content

Commit

Permalink
Add options schema to no-commonjs rule
Browse files Browse the repository at this point in the history
  • Loading branch information
futpib authored and ljharb committed Jun 23, 2017
1 parent 9a90f8b commit 78bc94b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/rules/no-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,37 @@ function allowRequire(node, options) {
// Rule Definition
//------------------------------------------------------------------------------

const schemaString = { enum: ['allow-primitive-modules'] }
const schemaObject = {
type: 'object',
properties: {
allowPrimitiveModules: { 'type': 'boolean' },
allowRequire: { 'type': 'boolean' },
},
additionalProperties: false,
}

module.exports = {
meta: {
docs: {
url: docsUrl('no-commonjs'),
},

schema: {
anyOf: [
{
type: 'array',
items: [schemaString],
additionalItems: false,
},
{
type: 'array',
items: [schemaObject],
additionalItems: false,
},
],
>>>>>>> Add options schema to `no-commonjs` rule
},
},

create: function (context) {
Expand Down

0 comments on commit 78bc94b

Please sign in to comment.