@mkaradeniz/eslint-config 5.5.0 → 5.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkaradeniz/eslint-config",
3
- "version": "5.5.0",
3
+ "version": "5.7.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "base.mjs",
@@ -8,6 +8,7 @@
8
8
  "next.mjs",
9
9
  "react.mjs",
10
10
  "shadcn.mjs",
11
+ "tanstackQuery.mjs",
11
12
  "turbo.mjs",
12
13
  "eslint.config.mjs",
13
14
  "rules/"
@@ -28,6 +29,7 @@
28
29
  "@eslint/compat": "^2.0.2",
29
30
  "@next/eslint-plugin-next": "^16.1.6",
30
31
  "@stylistic/eslint-plugin": "^5.8.0",
32
+ "@tanstack/eslint-plugin-query": "^5.91.4",
31
33
  "eslint-plugin-import-x": "^4.16.1",
32
34
  "eslint-plugin-jsdoc": "^62.5.5",
33
35
  "eslint-plugin-jsx-a11y": "^6.10.2",
@@ -8,34 +8,6 @@ export const reactRules = {
8
8
  'no-restricted-imports': [
9
9
  'warn',
10
10
  {
11
- paths: [
12
- {
13
- importNames: [
14
- 'createContext',
15
- 'forwardRef',
16
- 'startTransition',
17
- 'use',
18
- 'useCallback',
19
- 'useContext',
20
- 'useDebugValue',
21
- 'useDeferredValue',
22
- 'useEffect',
23
- 'useId',
24
- 'useImperativeHandle',
25
- 'useInsertionEffect',
26
- 'useLayoutEffect',
27
- 'useMemo',
28
- 'useReducer',
29
- 'useRef',
30
- 'useState',
31
- 'useSyncExternalStore',
32
- 'useTransition',
33
- ],
34
- message:
35
- "React built-in hooks & functions should not be imported directly. `import React from 'react'` and then use `React.useBuiltInHook()` || `React.function()`.",
36
- name: 'react',
37
- },
38
- ],
39
11
  patterns: [
40
12
  {
41
13
  allowImportNamePattern: 'Icon$',
@@ -48,6 +20,18 @@ export const reactRules = {
48
20
  'no-restricted-syntax': [
49
21
  baseNoRestrictedSyntaxSeverity,
50
22
  ...baseNoRestrictedSyntaxSelectors,
23
+ {
24
+ message: "Use named imports instead of `import React from 'react'`. Use `import { useState } from 'react'`.",
25
+ selector: "ImportDeclaration[source.value='react'] ImportDefaultSpecifier",
26
+ },
27
+ {
28
+ message: "Use named imports instead of `import * as React from 'react'`. Use `import { useState } from 'react'`.",
29
+ selector: "ImportDeclaration[source.value='react'] ImportNamespaceSpecifier",
30
+ },
31
+ {
32
+ message: "Use named imports instead of `React.method()`. Use `import { useState } from 'react'`.",
33
+ selector: "MemberExpression[object.name='React']",
34
+ },
51
35
  {
52
36
  message: 'Use the cn() utility instead of template literals for className.',
53
37
  selector: "JSXAttribute[name.name='className'] > JSXExpressionContainer > TemplateLiteral",
@@ -0,0 +1,11 @@
1
+ export const tanstackQueryRules = {
2
+ rules: {
3
+ '@tanstack/query/exhaustive-deps': ['warn'],
4
+ '@tanstack/query/infinite-query-property-order': ['warn'],
5
+ '@tanstack/query/mutation-property-order': ['warn'],
6
+ '@tanstack/query/no-rest-destructuring': ['warn'],
7
+ '@tanstack/query/no-unstable-deps': ['warn'],
8
+ '@tanstack/query/no-void-query-fn': ['warn'],
9
+ '@tanstack/query/stable-query-client': ['warn'],
10
+ },
11
+ };
@@ -0,0 +1,15 @@
1
+ import eslintPluginQuery from '@tanstack/eslint-plugin-query';
2
+
3
+ import { tanstackQueryRules } from './rules/tanstackQueryRules.mjs';
4
+
5
+ export const tanstackQueryConfig = [
6
+ {
7
+ plugins: {
8
+ /**
9
+ * https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query
10
+ */
11
+ '@tanstack/query': eslintPluginQuery,
12
+ },
13
+ },
14
+ { ...tanstackQueryRules },
15
+ ];