@tanstack/eslint-plugin-query 5.49.1 → 5.50.1
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/dist/cjs/index.cjs +30 -4
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +11 -2
- package/dist/esm/index.d.ts +11 -2
- package/dist/esm/index.js +30 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +47 -2
- package/dist/cjs/configs.cjs +0 -23
- package/dist/cjs/configs.cjs.map +0 -1
- package/dist/cjs/configs.d.cts +0 -6
- package/dist/esm/configs.d.ts +0 -6
- package/dist/esm/configs.js +0 -23
- package/dist/esm/configs.js.map +0 -1
- package/src/__tests__/configs.test.ts +0 -21
- package/src/configs.ts +0 -34
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const configs = require("./configs.cjs");
|
|
4
2
|
const rules = require("./rules.cjs");
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const plugin = {
|
|
4
|
+
meta: {
|
|
5
|
+
name: "@tanstack/eslint-plugin-query"
|
|
6
|
+
},
|
|
7
|
+
configs: {},
|
|
8
|
+
rules: rules.rules
|
|
9
|
+
};
|
|
10
|
+
Object.assign(plugin.configs, {
|
|
11
|
+
recommended: {
|
|
12
|
+
plugins: ["@tanstack/eslint-plugin-query"],
|
|
13
|
+
rules: {
|
|
14
|
+
"@tanstack/query/exhaustive-deps": "error",
|
|
15
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
16
|
+
"@tanstack/query/stable-query-client": "error"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"flat/recommended": [
|
|
20
|
+
{
|
|
21
|
+
plugins: {
|
|
22
|
+
"@tanstack/query": plugin
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
"@tanstack/query/exhaustive-deps": "error",
|
|
26
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
27
|
+
"@tanstack/query/stable-query-client": "error"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
module.exports = plugin;
|
|
7
33
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\ninterface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: Record<\n string,\n ESLint.ConfigData | Linter.FlatConfig | Array<Linter.FlatConfig>\n >\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-query',\n },\n configs: {},\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-query'],\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n },\n },\n 'flat/recommended': [\n {\n plugins: {\n '@tanstack/query': plugin,\n },\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"names":["rules"],"mappings":";;AAcA,MAAM,SAAiB;AAAA,EACrB,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,SAAS,CAAC;AAAA,EAAA,OACVA,MAAA;AACF;AAGA,OAAO,OAAO,OAAO,SAAS;AAAA,EAC5B,aAAa;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO;AAAA,MACL,mCAAmC;AAAA,MACnC,yCAAyC;AAAA,MACzC,uCAAuC;AAAA,IACzC;AAAA,EACF;AAAA,EACA,oBAAoB;AAAA,IAClB;AAAA,MACE,SAAS;AAAA,QACP,mBAAmB;AAAA,MACrB;AAAA,MACA,OAAO;AAAA,QACL,mCAAmC;AAAA,QACnC,yCAAyC;AAAA,QACzC,uCAAuC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF,CAAC;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { rules } from './rules.cjs';
|
|
2
|
+
import { ESLint, Linter } from 'eslint';
|
|
3
|
+
import { RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
|
4
|
+
|
|
5
|
+
type RuleKey = keyof typeof rules;
|
|
6
|
+
interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
7
|
+
rules: Record<RuleKey, RuleModule<any, any, any>>;
|
|
8
|
+
configs: Record<string, ESLint.ConfigData | Linter.FlatConfig | Array<Linter.FlatConfig>>;
|
|
9
|
+
}
|
|
10
|
+
declare const plugin: Plugin;
|
|
11
|
+
export default plugin;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { rules } from './rules.js';
|
|
2
|
+
import { ESLint, Linter } from 'eslint';
|
|
3
|
+
import { RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
|
4
|
+
|
|
5
|
+
type RuleKey = keyof typeof rules;
|
|
6
|
+
interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
7
|
+
rules: Record<RuleKey, RuleModule<any, any, any>>;
|
|
8
|
+
configs: Record<string, ESLint.ConfigData | Linter.FlatConfig | Array<Linter.FlatConfig>>;
|
|
9
|
+
}
|
|
10
|
+
declare const plugin: Plugin;
|
|
11
|
+
export default plugin;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
import { configs } from "./configs.js";
|
|
2
1
|
import { rules } from "./rules.js";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const plugin = {
|
|
3
|
+
meta: {
|
|
4
|
+
name: "@tanstack/eslint-plugin-query"
|
|
5
|
+
},
|
|
6
|
+
configs: {},
|
|
5
7
|
rules
|
|
6
8
|
};
|
|
9
|
+
Object.assign(plugin.configs, {
|
|
10
|
+
recommended: {
|
|
11
|
+
plugins: ["@tanstack/eslint-plugin-query"],
|
|
12
|
+
rules: {
|
|
13
|
+
"@tanstack/query/exhaustive-deps": "error",
|
|
14
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
15
|
+
"@tanstack/query/stable-query-client": "error"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"flat/recommended": [
|
|
19
|
+
{
|
|
20
|
+
plugins: {
|
|
21
|
+
"@tanstack/query": plugin
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
"@tanstack/query/exhaustive-deps": "error",
|
|
25
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
26
|
+
"@tanstack/query/stable-query-client": "error"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
plugin as default
|
|
33
|
+
};
|
|
7
34
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\ninterface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n rules: Record<RuleKey, RuleModule<any, any, any>>\n configs: Record<\n string,\n ESLint.ConfigData | Linter.FlatConfig | Array<Linter.FlatConfig>\n >\n}\n\nconst plugin: Plugin = {\n meta: {\n name: '@tanstack/eslint-plugin-query',\n },\n configs: {},\n rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-query'],\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n },\n },\n 'flat/recommended': [\n {\n plugins: {\n '@tanstack/query': plugin,\n },\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/no-rest-destructuring': 'warn',\n '@tanstack/query/stable-query-client': 'error',\n },\n },\n ],\n})\n\nexport default plugin\n"],"names":[],"mappings":";AAcA,MAAM,SAAiB;AAAA,EACrB,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,SAAS,CAAC;AAAA,EACV;AACF;AAGA,OAAO,OAAO,OAAO,SAAS;AAAA,EAC5B,aAAa;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO;AAAA,MACL,mCAAmC;AAAA,MACnC,yCAAyC;AAAA,MACzC,uCAAuC;AAAA,IACzC;AAAA,EACF;AAAA,EACA,oBAAoB;AAAA,IAClB;AAAA,MACE,SAAS;AAAA,QACP,mBAAmB;AAAA,MACrB;AAAA,MACA,OAAO;AAAA,QACL,mCAAmC;AAAA,QACnC,yCAAyC;AAAA,QACzC,uCAAuC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/eslint-plugin-query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.50.1",
|
|
4
4
|
"description": "ESLint plugin for TanStack Query",
|
|
5
5
|
"author": "Eliya Cohen",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
|
+
"sideEffects": false,
|
|
34
35
|
"files": [
|
|
35
36
|
"dist",
|
|
36
37
|
"src"
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { rules } from './rules'
|
|
2
|
+
import type { ESLint, Linter } from 'eslint'
|
|
3
|
+
import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'
|
|
4
|
+
|
|
5
|
+
type RuleKey = keyof typeof rules
|
|
6
|
+
|
|
7
|
+
interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
|
|
8
|
+
rules: Record<RuleKey, RuleModule<any, any, any>>
|
|
9
|
+
configs: Record<
|
|
10
|
+
string,
|
|
11
|
+
ESLint.ConfigData | Linter.FlatConfig | Array<Linter.FlatConfig>
|
|
12
|
+
>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const plugin: Plugin = {
|
|
16
|
+
meta: {
|
|
17
|
+
name: '@tanstack/eslint-plugin-query',
|
|
18
|
+
},
|
|
19
|
+
configs: {},
|
|
20
|
+
rules,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Assign configs here so we can reference `plugin`
|
|
24
|
+
Object.assign(plugin.configs, {
|
|
25
|
+
recommended: {
|
|
26
|
+
plugins: ['@tanstack/eslint-plugin-query'],
|
|
27
|
+
rules: {
|
|
28
|
+
'@tanstack/query/exhaustive-deps': 'error',
|
|
29
|
+
'@tanstack/query/no-rest-destructuring': 'warn',
|
|
30
|
+
'@tanstack/query/stable-query-client': 'error',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
'flat/recommended': [
|
|
34
|
+
{
|
|
35
|
+
plugins: {
|
|
36
|
+
'@tanstack/query': plugin,
|
|
37
|
+
},
|
|
38
|
+
rules: {
|
|
39
|
+
'@tanstack/query/exhaustive-deps': 'error',
|
|
40
|
+
'@tanstack/query/no-rest-destructuring': 'warn',
|
|
41
|
+
'@tanstack/query/stable-query-client': 'error',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export default plugin
|
package/dist/cjs/configs.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const rules = require("./rules.cjs");
|
|
4
|
-
function generateRecommendedConfig(allRules) {
|
|
5
|
-
return Object.entries(allRules).reduce(
|
|
6
|
-
(memo, [name, rule]) => {
|
|
7
|
-
const { recommended } = rule.meta.docs || {};
|
|
8
|
-
return {
|
|
9
|
-
...memo,
|
|
10
|
-
...recommended ? { [`@tanstack/query/${name}`]: recommended } : {}
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
{}
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
const configs = {
|
|
17
|
-
recommended: {
|
|
18
|
-
plugins: ["@tanstack/eslint-plugin-query"],
|
|
19
|
-
rules: generateRecommendedConfig(rules.rules)
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
exports.configs = configs;
|
|
23
|
-
//# sourceMappingURL=configs.cjs.map
|
package/dist/cjs/configs.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configs.cjs","sources":["../../src/configs.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLintUtils } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from './types'\n\nfunction generateRecommendedConfig(\n allRules: Record<\n string,\n ESLintUtils.RuleModule<\n string,\n ReadonlyArray<unknown>,\n ExtraRuleDocs,\n ESLintUtils.RuleListener\n >\n >,\n) {\n return Object.entries(allRules).reduce(\n (memo, [name, rule]) => {\n const { recommended } = rule.meta.docs || {}\n\n return {\n ...memo,\n ...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),\n }\n },\n {} as Record<string, ExtraRuleDocs['recommended']>,\n )\n}\n\nexport const configs = {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-query'],\n rules: generateRecommendedConfig(rules),\n },\n}\n"],"names":["rules"],"mappings":";;;AAIA,SAAS,0BACP,UASA;AACO,SAAA,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM;AACtB,YAAM,EAAE,YAAY,IAAI,KAAK,KAAK,QAAQ,CAAA;AAEnC,aAAA;AAAA,QACL,GAAG;AAAA,QACH,GAAI,cAAc,EAAE,CAAC,mBAAmB,IAAI,EAAE,GAAG,YAAY,IAAI,CAAC;AAAA,MAAA;AAAA,IAEtE;AAAA,IACA,CAAC;AAAA,EAAA;AAEL;AAEO,MAAM,UAAU;AAAA,EACrB,aAAa;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO,0BAA0BA,WAAK;AAAA,EACxC;AACF;;"}
|
package/dist/cjs/configs.d.cts
DELETED
package/dist/esm/configs.d.ts
DELETED
package/dist/esm/configs.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { rules } from "./rules.js";
|
|
2
|
-
function generateRecommendedConfig(allRules) {
|
|
3
|
-
return Object.entries(allRules).reduce(
|
|
4
|
-
(memo, [name, rule]) => {
|
|
5
|
-
const { recommended } = rule.meta.docs || {};
|
|
6
|
-
return {
|
|
7
|
-
...memo,
|
|
8
|
-
...recommended ? { [`@tanstack/query/${name}`]: recommended } : {}
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
{}
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
const configs = {
|
|
15
|
-
recommended: {
|
|
16
|
-
plugins: ["@tanstack/eslint-plugin-query"],
|
|
17
|
-
rules: generateRecommendedConfig(rules)
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
configs
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=configs.js.map
|
package/dist/esm/configs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configs.js","sources":["../../src/configs.ts"],"sourcesContent":["import { rules } from './rules'\nimport type { ESLintUtils } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from './types'\n\nfunction generateRecommendedConfig(\n allRules: Record<\n string,\n ESLintUtils.RuleModule<\n string,\n ReadonlyArray<unknown>,\n ExtraRuleDocs,\n ESLintUtils.RuleListener\n >\n >,\n) {\n return Object.entries(allRules).reduce(\n (memo, [name, rule]) => {\n const { recommended } = rule.meta.docs || {}\n\n return {\n ...memo,\n ...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),\n }\n },\n {} as Record<string, ExtraRuleDocs['recommended']>,\n )\n}\n\nexport const configs = {\n recommended: {\n plugins: ['@tanstack/eslint-plugin-query'],\n rules: generateRecommendedConfig(rules),\n },\n}\n"],"names":[],"mappings":";AAIA,SAAS,0BACP,UASA;AACO,SAAA,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM;AACtB,YAAM,EAAE,YAAY,IAAI,KAAK,KAAK,QAAQ,CAAA;AAEnC,aAAA;AAAA,QACL,GAAG;AAAA,QACH,GAAI,cAAc,EAAE,CAAC,mBAAmB,IAAI,EAAE,GAAG,YAAY,IAAI,CAAC;AAAA,MAAA;AAAA,IAEtE;AAAA,IACA,CAAC;AAAA,EAAA;AAEL;AAEO,MAAM,UAAU;AAAA,EACrB,aAAa;AAAA,IACX,SAAS,CAAC,+BAA+B;AAAA,IACzC,OAAO,0BAA0B,KAAK;AAAA,EACxC;AACF;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import { configs } from '../configs'
|
|
3
|
-
|
|
4
|
-
describe('configs', () => {
|
|
5
|
-
it('should match snapshot', () => {
|
|
6
|
-
expect(configs).toMatchInlineSnapshot(`
|
|
7
|
-
{
|
|
8
|
-
"recommended": {
|
|
9
|
-
"plugins": [
|
|
10
|
-
"@tanstack/eslint-plugin-query",
|
|
11
|
-
],
|
|
12
|
-
"rules": {
|
|
13
|
-
"@tanstack/query/exhaustive-deps": "error",
|
|
14
|
-
"@tanstack/query/no-rest-destructuring": "warn",
|
|
15
|
-
"@tanstack/query/stable-query-client": "error",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
`)
|
|
20
|
-
})
|
|
21
|
-
})
|
package/src/configs.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { rules } from './rules'
|
|
2
|
-
import type { ESLintUtils } from '@typescript-eslint/utils'
|
|
3
|
-
import type { ExtraRuleDocs } from './types'
|
|
4
|
-
|
|
5
|
-
function generateRecommendedConfig(
|
|
6
|
-
allRules: Record<
|
|
7
|
-
string,
|
|
8
|
-
ESLintUtils.RuleModule<
|
|
9
|
-
string,
|
|
10
|
-
ReadonlyArray<unknown>,
|
|
11
|
-
ExtraRuleDocs,
|
|
12
|
-
ESLintUtils.RuleListener
|
|
13
|
-
>
|
|
14
|
-
>,
|
|
15
|
-
) {
|
|
16
|
-
return Object.entries(allRules).reduce(
|
|
17
|
-
(memo, [name, rule]) => {
|
|
18
|
-
const { recommended } = rule.meta.docs || {}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
...memo,
|
|
22
|
-
...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{} as Record<string, ExtraRuleDocs['recommended']>,
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const configs = {
|
|
30
|
-
recommended: {
|
|
31
|
-
plugins: ['@tanstack/eslint-plugin-query'],
|
|
32
|
-
rules: generateRecommendedConfig(rules),
|
|
33
|
-
},
|
|
34
|
-
}
|