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 1c9f61c commit c438d3e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/rules/no-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,36 @@ 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,
},
],
},
},

create: function (context) {
Expand Down

0 comments on commit c438d3e

Please sign in to comment.