Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

move schemas into meta #55

Merged
merged 2 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rules/define-tag-after-class-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
const classes = ClassRefTracker.customElements(context)
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/expose-class-on-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
const classes = ClassRefTracker.customElements(context)
return {
Expand Down
16 changes: 8 additions & 8 deletions lib/rules/extends-correct-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ module.exports = {
meta: {
type: 'problem',
docs: {description: '', url: require('../url')(module)},
},
schema: [
{
type: 'object',
properties: {
allowedSuperNames: {type: 'array', items: {type: 'string'}},
schema: [
{
type: 'object',
properties: {
allowedSuperNames: {type: 'array', items: {type: 'string'}},
},
},
},
],
],
},
create(context) {
const classes = new ClassRefTracker(context)
return {
Expand Down
46 changes: 23 additions & 23 deletions lib/rules/file-name-matches-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
},
schema: [
{
type: 'object',
properties: {
transform: {
oneOf: [
{enum: ['none', 'snake', 'kebab', 'pascal']},
{
type: 'array',
items: {enum: ['none', 'snake', 'kebab', 'pascal']},
minItems: 1,
maxItems: 4,
},
],
},
suffix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
matchDirectory: {
type: 'boolean',
schema: [
{
type: 'object',
properties: {
transform: {
oneOf: [
{enum: ['none', 'snake', 'kebab', 'pascal']},
{
type: 'array',
items: {enum: ['none', 'snake', 'kebab', 'pascal']},
minItems: 1,
maxItems: 4,
},
],
},
suffix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
matchDirectory: {
type: 'boolean',
},
},
},
},
],
],
},
create(context) {
if (!hasFileName(context)) return {}
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
return {
[`${s.HTMLElementClass} MethodDefinition[key.name="constructor"]`](node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-customized-built-in-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = {
meta: {
type: 'problem',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
return {
[s.HTMLElementClass](node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
return {
[`${s.HTMLElementClass} MethodDefinition[key.name="attributeChangedCallback"] MemberExpression`](node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-dom-traversal-in-connectedcallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
return {
[`${s.HTMLElementClass} MethodDefinition[key.name="connectedCallback"] MemberExpression`](node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-exports-with-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = {
meta: {
type: 'layout',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
const classes = ClassRefTracker.customElements(context)
const eventClasses = ClassRefTracker.customEvents(context)
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-method-prefixed-with-on.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
return {
[`${s.HTMLElementClass} MethodDefinition[key.name=/^on.*$/i]`](node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unchecked-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = {
meta: {
type: 'layout',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
definedCustomElements = new Map()
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/one-element-per-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
meta: {
type: 'layout',
docs: {description: '', url: require('../url')(module)},
schema: [],
},
schema: [],
create(context) {
let classCount = 0
return {
Expand Down
24 changes: 12 additions & 12 deletions lib/rules/tag-name-matches-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ module.exports = {
meta: {
type: 'suggestion',
docs: {description: '', url: require('../url')(module)},
},
schema: [
{
type: 'object',
properties: {
suffix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
prefix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
schema: [
{
type: 'object',
properties: {
suffix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
prefix: {
onfOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
},
},
},
],
],
},
create(context) {
return {
[s.customElements.define](node) {
Expand Down
28 changes: 14 additions & 14 deletions lib/rules/valid-tag-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ module.exports = {
meta: {
type: 'problem',
docs: {description: '', url: require('../url')(module)},
},
schema: [
{
type: 'object',
properties: {
disallowNamespaces: {type: 'boolean'},
onlyAlphanum: {type: 'boolean'},
prefix: {
oneOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
suffix: {
oneOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
schema: [
{
type: 'object',
properties: {
disallowNamespaces: {type: 'boolean'},
onlyAlphanum: {type: 'boolean'},
prefix: {
oneOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
suffix: {
oneOf: [{type: 'string'}, {type: 'array', items: {type: 'string'}}],
},
},
},
},
],
],
},
create(context) {
return {
[s.customElements.define](node) {
Expand Down
2 changes: 1 addition & 1 deletion test/check-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('documentation', () => {
'## Rule Details',
'👎 Examples of **incorrect** code for this rule:',
'👍 Examples of **correct** code for this rule:',
config.rules?.[doc]?.schema?.length ? '### Options' : '',
config.rules?.[doc]?.meta.schema?.length ? '### Options' : '',
'## When Not To Use It',
'## Version',
].filter(Boolean)
Expand Down