Skip to content

Commit

Permalink
Merge pull request #1139 from wantedly/chloe463/hotfix/rule-option-sc…
Browse files Browse the repository at this point in the history
…hema

hotfix(eslint-plugin): Fix option schema
  • Loading branch information
chloe463 authored Sep 27, 2024
2 parents e5eccf6 + b06c9fa commit 91677d8
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 185 deletions.
6 changes: 6 additions & 0 deletions .changeset/dull-terms-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"eslint-plugin-use-macros": patch
"eslint-plugin-wantedly": patch
---

hotfix(eslint-plugin): Fix option schema
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ ruleTester.run("use-macros/graphql-tag", GraphQLTagRule, {
valid: [
{
code: `import { gql } from "graphql.macro";`,
options: ["error"],
},
],
invalid: [
{
code: `import gql from "graphql-tag";`,
output: `import { gql } from "graphql.macro";`,
errors: ['Please import from "graphql.macro" instead of "graphql-tag"'],
options: ["error"],
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ ruleTester.run("use-macros/styled-components", StyledComponentsRule, {
valid: [
{
code: `import styled from "styled-components/macro";`,
options: ["error"],
},
],
invalid: [
{
code: `import styled from "styled-components";`,
output: `import styled from "styled-components/macro";`,
errors: ['Please import from "styled-components/macro" instead of "styled-components"'],
options: ["error"],
},
],
});
5 changes: 0 additions & 5 deletions packages/eslint-plugin-use-macros/rules/GraphQLTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ module.exports = {
meta: {
type: "suggestion",
fixable: "code",
schema: [
{
enum: ["error", "warn", "off"],
},
],
},
create(context) {
return {
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-plugin-use-macros/rules/StyledComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ module.exports = {
meta: {
type: "suggestion",
fixable: "code",
schema: [
{
enum: ["error", "warn", "off"],
},
],
},
create(context) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -43,13 +36,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -71,13 +57,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -98,15 +77,6 @@ exports[`should match snapshot 1`] = `
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-enum-values-description.md",
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -117,15 +87,6 @@ exports[`should match snapshot 1`] = `
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-field-description.md",
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -137,13 +98,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -163,15 +117,6 @@ exports[`should match snapshot 1`] = `
"docs": {
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-type-description.md",
},
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -183,13 +128,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -217,13 +155,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -245,13 +176,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -273,13 +197,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -300,15 +217,6 @@ exports[`should match snapshot 1`] = `
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-enum-values-description.md",
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -319,15 +227,6 @@ exports[`should match snapshot 1`] = `
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-field-description.md",
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -339,13 +238,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand All @@ -365,15 +257,6 @@ exports[`should match snapshot 1`] = `
"docs": {
"url": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly/docs/rules/nexus-type-description.md",
},
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
],
"type": "suggestion",
},
},
Expand All @@ -385,13 +268,6 @@ exports[`should match snapshot 1`] = `
},
"fixable": "code",
"schema": [
{
"enum": [
"error",
"warn",
"off",
],
},
{
"additionalProperties": false,
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ gql\`
}
\`;`,
errors: ["The operation name getProject should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
{
name: "No operation name is specified for a query",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ruleTester.run(RULE_NAME, RULE, {
}
\`;`,
errors: ["The interface type node should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
{
name: "Type name is fixed by plugin",
Expand All @@ -100,7 +100,7 @@ ruleTester.run(RULE_NAME, RULE, {
}
\`;`,
errors: ["The object type foo should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
{
name: "Fragment name is fixed by plugin",
Expand All @@ -115,7 +115,7 @@ ruleTester.run(RULE_NAME, RULE, {
}
\`;`,
errors: ["The fragment fooFragment should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
{
name: "Nested fragment name is fixed by plugin",
Expand All @@ -132,7 +132,7 @@ ruleTester.run(RULE_NAME, RULE, {
\$\{BarFragment\}
\`;`,
errors: ["The fragment fooFragment should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
{
name: "Nested fragment name is fixed by plugin 2",
Expand All @@ -149,7 +149,7 @@ ruleTester.run(RULE_NAME, RULE, {
}
\`;`,
errors: ["The fragment fooFragment should be PascalCase"],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const User = objectType({
"The field Profile should be camelCase",
"The field Posts should be camelCase",
],
options: ["error"],
},
{
name: "Auto fix enabled",
Expand Down Expand Up @@ -78,7 +77,7 @@ const User = objectType({
"The field Profile should be camelCase",
"The field Posts should be camelCase",
],
options: ["error", { autofix: true }],
options: [{ autofix: true }],
},
],
});
Loading

0 comments on commit 91677d8

Please sign in to comment.