@kununu/eslint-config 7.4.6 → 7.5.0
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/README.md +3 -0
- package/eslint.config.mjs +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,9 @@ ecosystem, with kununu's own conventions layered on top.
|
|
|
114
114
|
relative imports.
|
|
115
115
|
- **Granular Redux selectors** are enforced for `use*Selector*` and `use*Store*`
|
|
116
116
|
hooks.
|
|
117
|
+
- **No direct `/kunubi/event` requests.** Use `sendKunubiEvent` from
|
|
118
|
+
`@kununu/kununu-common` instead of posting to the endpoint by hand; it types
|
|
119
|
+
the payload and fills in the event metadata.
|
|
117
120
|
- **Formatting** comes from `@stylistic`: 120-character lines (ignoring
|
|
118
121
|
comments, strings and URLs), semicolons and single quotes, among others.
|
|
119
122
|
- **React Compiler rules** such as `react-hooks/refs` and
|
package/eslint.config.mjs
CHANGED
|
@@ -207,6 +207,15 @@ export default defineConfig([
|
|
|
207
207
|
],
|
|
208
208
|
},
|
|
209
209
|
],
|
|
210
|
+
'no-restricted-syntax': [
|
|
211
|
+
'error',
|
|
212
|
+
{
|
|
213
|
+
message: '\n Do not POST to /kunubi/event directly. Use sendKunubiEvent from @kununu/kununu-common (tracking/kunubi/sendKunubiEvent) - it types the payload against @kununu/kunubi-event-types and fills in name/payload/source for you.',
|
|
214
|
+
// Matches the bare literal anywhere, not only as a call argument: some
|
|
215
|
+
// call sites assign the path to a variable before passing it on.
|
|
216
|
+
selector: 'Literal[value="/kunubi/event"]',
|
|
217
|
+
},
|
|
218
|
+
],
|
|
210
219
|
'no-use-before-define': 'off',
|
|
211
220
|
'perfectionist/sort-imports': [
|
|
212
221
|
'error',
|
|
@@ -317,4 +326,14 @@ export default defineConfig([
|
|
|
317
326
|
'sonarjs/todo-tag': ['warn'],
|
|
318
327
|
},
|
|
319
328
|
},
|
|
329
|
+
|
|
330
|
+
// Must stay after the general rules block above: that block has no `files`
|
|
331
|
+
// key, so it applies to spec files too and would otherwise re-enable these.
|
|
332
|
+
{
|
|
333
|
+
files: ['**/*.spec.*'],
|
|
334
|
+
rules: {
|
|
335
|
+
// Specs legitimately assert on the request URL.
|
|
336
|
+
'no-restricted-syntax': 'off',
|
|
337
|
+
},
|
|
338
|
+
},
|
|
320
339
|
]);
|