@nitra/eslint-config 3.6.8 → 3.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +25 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -115,6 +115,30 @@ const graphqlEslintPluginWithDebug = {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* `@graphql-eslint/naming-convention` з operations-recommended плюс сумісність із Hasura:
|
|
120
|
+
* аргументи на кшталт `_set`, `_eq` мають провідний підкреслювач — без `allowLeadingUnderscore`
|
|
121
|
+
* правило глобально лає будь-який `Name`, що починається з `_` (не лише camelCase для змінних).
|
|
122
|
+
* @see https://the-guild.dev/graphql/eslint/rules/naming-convention
|
|
123
|
+
*/
|
|
124
|
+
const graphqlNamingConventionHasuraFriendly = [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
allowLeadingUnderscore: true,
|
|
128
|
+
VariableDefinition: 'camelCase',
|
|
129
|
+
OperationDefinition: {
|
|
130
|
+
style: 'PascalCase',
|
|
131
|
+
forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'],
|
|
132
|
+
forbiddenSuffixes: ['Query', 'Mutation', 'Subscription']
|
|
133
|
+
},
|
|
134
|
+
FragmentDefinition: {
|
|
135
|
+
style: 'PascalCase',
|
|
136
|
+
forbiddenPrefixes: ['Fragment'],
|
|
137
|
+
forbiddenSuffixes: ['Fragment']
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
|
|
118
142
|
/**
|
|
119
143
|
* Правила для витягнутих GraphQL-блоків: пресет operations-recommended (поля, типи, змінні).
|
|
120
144
|
* Схема та documents підтягуються через graphql-config (файл налаштувань у корені пакета з операціями, зазвичай YAML).
|
|
@@ -131,6 +155,7 @@ const graphqlExtractedDocumentLint = {
|
|
|
131
155
|
},
|
|
132
156
|
rules: {
|
|
133
157
|
...graphqlEslintPlugin.configs['flat/operations-recommended'].rules,
|
|
158
|
+
'@graphql-eslint/naming-convention': graphqlNamingConventionHasuraFriendly,
|
|
134
159
|
'@graphql-eslint/no-deprecated': 'error'
|
|
135
160
|
}
|
|
136
161
|
}
|