@nfq/eslint-config 4.0.0-beta.11 → 4.0.0-beta.13

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/esm/index.js CHANGED
@@ -9,6 +9,7 @@ import { commonPluginRules } from './rules/common/plugins/index.js';
9
9
  import { commonEslintRules } from './rules/common/eslint/index.js';
10
10
  import { typescriptRuleResets } from './rules/typescript/overrides/index.js';
11
11
  import { tsRules } from './rules/typescript/plugins/index.js';
12
+ import { storybookResets } from './rules/storybook/overrides/resets.js';
12
13
  import { cypressResets } from './rules/cypress/overrides/resets.js';
13
14
  import { cypressPluginRules } from './rules/cypress/plugins/index.js';
14
15
 
@@ -66,6 +67,35 @@ const NFQEslintConfig = [settings, {
66
67
  ...tsRules,
67
68
  ...typescriptRuleResets
68
69
  }
70
+ }, {
71
+ files: ['**/*.stories.{ts,cts,mts,tsx}'],
72
+ languageOptions: {
73
+ ecmaVersion: 'latest',
74
+ globals,
75
+ parser: tsParser,
76
+ parserOptions: {
77
+ ecmaFeatures: {
78
+ jsx: true
79
+ },
80
+ ecmaVersion: 'latest',
81
+ project: '**/tsconfig*.json'
82
+ }
83
+ },
84
+ linterOptions: {
85
+ reportUnusedDisableDirectives: 'error',
86
+ reportUnusedInlineConfigs: 'error'
87
+ },
88
+ name: 'NFQ ESLint TS Story Config',
89
+ plugins: tsPlugins,
90
+ rules: {
91
+ ...commonEslintRules,
92
+ ...commonPluginRules,
93
+ ...nodeRules,
94
+ ...reactPluginRules,
95
+ ...tsRules,
96
+ ...typescriptRuleResets,
97
+ ...storybookResets
98
+ }
69
99
  }, {
70
100
  files: ['**/*.cy.{ts,cts,mts,tsx}'],
71
101
  languageOptions: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import * as tsParser from '@typescript-eslint/parser';\n\nimport {\n commonEslintRules,\n commonPluginRules,\n cypressPluginRules,\n cypressResets,\n nodeRules,\n reactPluginRules,\n tsRules,\n typescriptRuleResets\n} from './rules';\nimport {globals} from './settings/globals';\nimport {plugins} from './settings/plugins';\nimport {settings} from './settings/settings';\nimport {tsPlugins} from './settings/tsPlugins';\n\nexport const NFQEslintConfig = [\n settings,\n {\n files: ['**/*.{js,cjs,mjs,jsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint JS Config',\n plugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules\n }\n },\n {\n files: ['**/*.{ts,cts,mts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint TS Config',\n plugins: tsPlugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules,\n ...tsRules,\n ...typescriptRuleResets\n }\n },\n {\n files: ['**/*.cy.{ts,cts,mts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint Cypress Config',\n plugins: tsPlugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules,\n ...tsRules,\n ...typescriptRuleResets,\n ...cypressPluginRules,\n ...cypressResets\n }\n }\n];\n\nexport {globals, plugins, settings, tsPlugins};"],"names":["NFQEslintConfig","settings","files","languageOptions","ecmaVersion","globals","parser","tsParser","parserOptions","ecmaFeatures","jsx","project","linterOptions","reportUnusedDisableDirectives","reportUnusedInlineConfigs","name","plugins","rules","commonEslintRules","commonPluginRules","nodeRules","reactPluginRules","tsPlugins","tsRules","typescriptRuleResets","cypressPluginRules","cypressResets"],"mappings":";;;;;;;;;;;;;;AAiBO,MAAMA,eAAe,GAAG,CAC3BC,QAAQ,EACR;EACIC,KAAK,EAAE,CAAC,uBAAuB,CAAC;AAChCC,EAAAA,eAAe,EAAE;AACbC,IAAAA,WAAW,EAAE,QAAQ;IACrBC,OAAO;AACPC,IAAAA,MAAM,EAAEC,QAAQ;AAChBC,IAAAA,aAAa,EAAE;AACXC,MAAAA,YAAY,EAAE;AAACC,QAAAA,GAAG,EAAE;OAAK;AACzBN,MAAAA,WAAW,EAAE,QAAQ;AACrBO,MAAAA,OAAO,EAAE;AACb;GACH;AACDC,EAAAA,aAAa,EAAE;AACXC,IAAAA,6BAA6B,EAAE,OAAO;AACtCC,IAAAA,yBAAyB,EAAE;GAC9B;AACDC,EAAAA,IAAI,EAAE,sBAAsB;EAC5BC,OAAO;AACPC,EAAAA,KAAK,EAAE;AACH,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,SAAS;IACZ,GAAGC;AACP;AACJ,CAAC,EACD;EACInB,KAAK,EAAE,CAAC,uBAAuB,CAAC;AAChCC,EAAAA,eAAe,EAAE;AACbC,IAAAA,WAAW,EAAE,QAAQ;IACrBC,OAAO;AACPC,IAAAA,MAAM,EAAEC,QAAQ;AAChBC,IAAAA,aAAa,EAAE;AACXC,MAAAA,YAAY,EAAE;AAACC,QAAAA,GAAG,EAAE;OAAK;AACzBN,MAAAA,WAAW,EAAE,QAAQ;AACrBO,MAAAA,OAAO,EAAE;AACb;GACH;AACDC,EAAAA,aAAa,EAAE;AACXC,IAAAA,6BAA6B,EAAE,OAAO;AACtCC,IAAAA,yBAAyB,EAAE;GAC9B;AACDC,EAAAA,IAAI,EAAE,sBAAsB;AAC5BC,EAAAA,OAAO,EAAEM,SAAS;AAClBL,EAAAA,KAAK,EAAE;AACH,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,SAAS;AACZ,IAAA,GAAGC,gBAAgB;AACnB,IAAA,GAAGE,OAAO;IACV,GAAGC;AACP;AACJ,CAAC,EACD;EACItB,KAAK,EAAE,CAAC,0BAA0B,CAAC;AACnCC,EAAAA,eAAe,EAAE;AACbC,IAAAA,WAAW,EAAE,QAAQ;IACrBC,OAAO;AACPC,IAAAA,MAAM,EAAEC,QAAQ;AAChBC,IAAAA,aAAa,EAAE;AACXC,MAAAA,YAAY,EAAE;AAACC,QAAAA,GAAG,EAAE;OAAK;AACzBN,MAAAA,WAAW,EAAE,QAAQ;AACrBO,MAAAA,OAAO,EAAE;AACb;GACH;AACDC,EAAAA,aAAa,EAAE;AACXC,IAAAA,6BAA6B,EAAE,OAAO;AACtCC,IAAAA,yBAAyB,EAAE;GAC9B;AACDC,EAAAA,IAAI,EAAE,2BAA2B;AACjCC,EAAAA,OAAO,EAAEM,SAAS;AAClBL,EAAAA,KAAK,EAAE;AACH,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,SAAS;AACZ,IAAA,GAAGC,gBAAgB;AACnB,IAAA,GAAGE,OAAO;AACV,IAAA,GAAGC,oBAAoB;AACvB,IAAA,GAAGC,kBAAkB;IACrB,GAAGC;AACP;AACJ,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import * as tsParser from '@typescript-eslint/parser';\n\nimport {\n commonEslintRules,\n commonPluginRules,\n cypressPluginRules,\n cypressResets,\n nodeRules,\n reactPluginRules,\n storybookResets,\n tsRules,\n typescriptRuleResets\n} from './rules';\nimport {globals} from './settings/globals';\nimport {plugins} from './settings/plugins';\nimport {settings} from './settings/settings';\nimport {tsPlugins} from './settings/tsPlugins';\n\nexport const NFQEslintConfig = [\n settings,\n {\n files: ['**/*.{js,cjs,mjs,jsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint JS Config',\n plugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules\n }\n },\n {\n files: ['**/*.{ts,cts,mts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint TS Config',\n plugins: tsPlugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules,\n ...tsRules,\n ...typescriptRuleResets\n }\n },\n {\n files: ['**/*.stories.{ts,cts,mts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint TS Story Config',\n plugins: tsPlugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules,\n ...tsRules,\n ...typescriptRuleResets,\n ...storybookResets\n }\n },\n {\n files: ['**/*.cy.{ts,cts,mts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals,\n parser: tsParser,\n parserOptions: {\n ecmaFeatures: {jsx: true},\n ecmaVersion: 'latest',\n project: '**/tsconfig*.json'\n }\n },\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n reportUnusedInlineConfigs: 'error'\n },\n name: 'NFQ ESLint Cypress Config',\n plugins: tsPlugins,\n rules: {\n ...commonEslintRules,\n ...commonPluginRules,\n ...nodeRules,\n ...reactPluginRules,\n ...tsRules,\n ...typescriptRuleResets,\n ...cypressPluginRules,\n ...cypressResets\n }\n }\n];\n\nexport {globals, plugins, settings, tsPlugins};"],"names":["NFQEslintConfig","settings","files","languageOptions","ecmaVersion","globals","parser","tsParser","parserOptions","ecmaFeatures","jsx","project","linterOptions","reportUnusedDisableDirectives","reportUnusedInlineConfigs","name","plugins","rules","commonEslintRules","commonPluginRules","nodeRules","reactPluginRules","tsPlugins","tsRules","typescriptRuleResets","storybookResets","cypressPluginRules","cypressResets"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAMA,eAAe,GAAG,CAC3BC,QAAQ,EACR;EACIC,KAAK,EAAE,CAAC,uBAAuB,CAAC;AAChCC,EAAAA,eAAe,EAAE;AACbC,IAAAA,WAAW,EAAE,QAAQ;IACrBC,OAAO;AACPC,IAAAA,MAAM,EAAEC,QAAQ;AAChBC,IAAAA,aAAa,EAAE;AACXC,MAAAA,YAAY,EAAE;AAACC,QAAAA,GAAG,EAAE;OAAK;AACzBN,MAAAA,WAAW,EAAE,QAAQ;AACrBO,MAAAA,OAAO,EAAE;AACb;GACH;AACDC,EAAAA,aAAa,EAAE;AACXC,IAAAA,6BAA6B,EAAE,OAAO;AACtCC,IAAAA,yBAAyB,EAAE;GAC9B;AACDC,EAAAA,IAAI,EAAE,sBAAsB;EAC5BC,OAAO;AACPC,EAAAA,KAAK,EAAE;AACH,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,SAAS;IACZ,GAAGC;AACP;AACJ,CAAC,EACD;EACInB,KAAK,EAAE,CAAC,uBAA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AGE,OAAO;AACV,IAAA,GAAGC,oBAAoB;IACvB,GAAGC;AACP;AACJ,CAAC,EACD;EACIvB,KAAK,EAAE,CAAC,0BAA0B,CAAC;AACnCC,EAAAA,eAAe,EAAE;AACbC,IAAAA,WAAW,EAAE,QAAQ;IACrBC,OAAO;AACPC,IAAAA,MAAM,EAAEC,QAAQ;AAChBC,IAAAA,aAAa,EAAE;AACXC,MAAAA,YAAY,EAAE;AAACC,QAAAA,GAAG,EAAE;OAAK;AACzBN,MAAAA,WAAW,EAAE,QAAQ;AACrBO,MAAAA,OAAO,EAAE;AACb;GACH;AACDC,EAAAA,aAAa,EAAE;AACXC,IAAAA,6BAA6B,EAAE,OAAO;AACtCC,IAAAA,yBAAyB,EAAE;GAC9B;AACDC,EAAAA,IAAI,EAAE,2BAA2B;AACjCC,EAAAA,OAAO,EAAEM,SAAS;AAClBL,EAAAA,KAAK,EAAE;AACH,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,iBAAiB;AACpB,IAAA,GAAGC,SAAS;AACZ,IAAA,GAAGC,gBAAgB;AACnB,IAAA,GAAGE,OAAO;AACV,IAAA,GAAGC,oBAAoB;AACvB,IAAA,GAAGE,kBAAkB;IACrB,GAAGC;AACP;AACJ,CAAC;;;;"}
@@ -40,6 +40,64 @@ const noUnboundMethod = createRule$4({
40
40
  const reportCache = new Map();
41
41
  const aliasCache = new Map();
42
42
  const memberSymbolCache = new Map();
43
+ const classAutoBindCache = new WeakMap();
44
+ const isAutoBindOption = node => {
45
+ if (!ts.isObjectLiteralExpression(node)) {
46
+ return false;
47
+ }
48
+ return node.properties.some(property => {
49
+ if (!ts.isPropertyAssignment(property)) {
50
+ return false;
51
+ }
52
+ const name = ts.isIdentifier(property.name) ? property.name.text : ts.isStringLiteral(property.name) ? property.name.text : null;
53
+ if (name !== 'autoBind') {
54
+ return false;
55
+ }
56
+ return property.initializer.kind === ts.SyntaxKind.TrueKeyword;
57
+ });
58
+ };
59
+ const isMakeAutoObservableCallee = node => {
60
+ if (ts.isIdentifier(node)) {
61
+ return node.text === 'makeAutoObservable';
62
+ }
63
+ return ts.isPropertyAccessExpression(node) && node.name.text === 'makeAutoObservable';
64
+ };
65
+ const hasAutoBindInConstructor = classDecl => {
66
+ const cached = classAutoBindCache.get(classDecl);
67
+ if (cached !== undefined) {
68
+ return cached;
69
+ }
70
+ const ctor = classDecl.members.find(member => ts.isConstructorDeclaration(member));
71
+ if (!ctor?.body) {
72
+ classAutoBindCache.set(classDecl, false);
73
+ return false;
74
+ }
75
+ for (const statement of ctor.body.statements) {
76
+ if (!ts.isExpressionStatement(statement)) {
77
+ continue;
78
+ }
79
+ const expr = statement.expression;
80
+ if (!ts.isCallExpression(expr)) {
81
+ continue;
82
+ }
83
+ if (!isMakeAutoObservableCallee(expr.expression)) {
84
+ continue;
85
+ }
86
+ if (expr.arguments.length < 2) {
87
+ continue;
88
+ }
89
+ if (expr.arguments[0].kind !== ts.SyntaxKind.ThisKeyword) {
90
+ continue;
91
+ }
92
+ const hasAutoBind = expr.arguments.slice(1).some(arg => isAutoBindOption(arg));
93
+ if (hasAutoBind) {
94
+ classAutoBindCache.set(classDecl, true);
95
+ return true;
96
+ }
97
+ }
98
+ classAutoBindCache.set(classDecl, false);
99
+ return false;
100
+ };
43
101
  const resolveSymbol = symbol => {
44
102
  const cached = aliasCache.get(symbol);
45
103
  if (cached) {
@@ -74,6 +132,7 @@ const noUnboundMethod = createRule$4({
74
132
  return Boolean(name && decoratorNames.has(name));
75
133
  }));
76
134
  const info = {
135
+ autoBind: hasAutoBindInConstructor(methodDecl.parent),
77
136
  hasDecorator,
78
137
  isStatic,
79
138
  usesThis: methodUsesThis(methodDecl)
@@ -92,7 +151,7 @@ const noUnboundMethod = createRule$4({
92
151
  reportCache.set(aliased, false);
93
152
  return false;
94
153
  }
95
- const shouldReport = !info.isStatic && info.usesThis && !info.hasDecorator;
154
+ const shouldReport = !info.autoBind && !info.isStatic && info.usesThis && !info.hasDecorator;
96
155
  reportCache.set(aliased, shouldReport);
97
156
  return shouldReport;
98
157
  };
@@ -1 +1 @@
1
- {"version":3,"file":"no-unbound-method.js","sources":["../../../../src/rules/custom/no-unbound-method.ts"],"sourcesContent":["import {AST_NODE_TYPES, ESLintUtils} from '@typescript-eslint/utils';\nimport ts from 'typescript';\n\nimport {\n DEFAULT_DECORATORS,\n getDecoratorName,\n isCallbackUsage,\n isThisBindCall,\n methodUsesThis,\n normalizeDecoratorNames,\n unwrapExpression\n} from './utils/no-unbound-method-utils';\n\nimport type {TSESLint, TSESTree} from '@typescript-eslint/utils';\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/nfqde/eslint-config-nfq/blob/master/docs/rules/${name}.md`\n);\n\ntype RuleOptions = [\n {decoratorNames?: string[]}?\n];\n\ntype MessageIds = 'constructorBind' | 'unboundMethod';\n\ntype MethodInfo = {\n hasDecorator: boolean;\n isStatic: boolean;\n usesThis: boolean;\n};\n\nexport const noUnboundMethod = createRule<RuleOptions, MessageIds>({\n defaultOptions: [{decoratorNames: DEFAULT_DECORATORS}],\n meta: {\n docs: {description: 'Warn when unbound class methods that use this are passed as callbacks.'},\n messages: {\n constructorBind: 'Do not bind in the constructor; prefer {{decoratorName}}.',\n unboundMethod: 'Method {{methodName}} uses this and is passed unbound. Add {{decoratorName}} or bind it.'\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n decoratorNames: {\n items: {type: 'string'},\n type: 'array',\n uniqueItems: true\n }\n },\n type: 'object'\n }\n ],\n type: 'problem'\n },\n name: 'no-unbound-method',\n /**\n * Creates the rule listeners and initializes caches for symbol analysis.\n * It wires the parser services to the TypeScript type checker and configures decorator handling.\n * It returns ESLint listeners that report unbound method usage in callbacks and constructor binding.\n *\n * @param context Rule context used to access parser services and report issues.\n * @returns The rule listener map for this rule.\n *\n * @example\n * ```tsx\n * const listeners = rule.create(context);\n * ```\n */\n create(context) {\n const services = ESLintUtils.getParserServices(context);\n const checker = services.program.getTypeChecker();\n const decoratorNames = normalizeDecoratorNames(context.options[0]?.decoratorNames);\n const decoratorLabel = `@${Array.from(decoratorNames)[0] ?? 'autobind'}`;\n const methodCache = new Map<ts.Symbol, MethodInfo>();\n const reportCache = new Map<ts.Symbol, boolean>();\n const aliasCache = new Map<ts.Symbol, ts.Symbol>();\n const memberSymbolCache = new Map<TSESTree.MemberExpression, ts.Symbol | null>();\n\n /**\n * Resolves an alias symbol to its original symbol and caches the result for reuse.\n * This function avoids repeated TypeScript checker work by memoizing alias resolutions.\n * It ensures downstream analysis consistently uses the same canonical symbol instance.\n *\n * @param symbol The symbol that may be an alias and needs resolution.\n * @returns The resolved canonical symbol for further analysis.\n *\n * @example\n * ```tsx\n * const resolved = resolveSymbol(methodSymbol);\n * ```\n */\n const resolveSymbol = (symbol: ts.Symbol): ts.Symbol => {\n const cached = aliasCache.get(symbol);\n\n if (cached) {\n return cached;\n }\n\n // eslint-disable-next-line no-bitwise\n const resolved = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;\n\n aliasCache.set(symbol, resolved);\n\n return resolved;\n };\n\n /**\n * Computes metadata about a method-like symbol and caches the result for later use.\n * This function filters out non-method symbols and constructor declarations before gathering details.\n * It also determines decorator presence, static status, and whether the method uses `this`.\n *\n * @param symbol The symbol to inspect for method information.\n * @returns The resolved method info or null when the symbol is not a supported method.\n *\n * @example\n * ```tsx\n * const info = getMethodInfo(methodSymbol);\n * ```\n */\n const getMethodInfo = (symbol: ts.Symbol): MethodInfo | null => {\n const aliased = resolveSymbol(symbol);\n const cached = methodCache.get(aliased);\n\n if (cached) {\n return cached;\n }\n\n if (!(\n // eslint-disable-next-line no-bitwise\n aliased.flags\n & (\n // eslint-disable-next-line no-bitwise\n ts.SymbolFlags.Method\n | ts.SymbolFlags.Property\n | ts.SymbolFlags.Function\n | ts.SymbolFlags.GetAccessor\n | ts.SymbolFlags.SetAccessor\n )\n )) {\n return null;\n }\n\n const declarations = aliased.getDeclarations() ?? [];\n const methodDecl = declarations\n .find(decl => ts.isMethodDeclaration(decl));\n\n if (!methodDecl?.parent || !ts.isClassLike(methodDecl.parent)) {\n return null;\n }\n\n if (ts.isIdentifier(methodDecl.name) && methodDecl.name.text === 'constructor') {\n return null;\n }\n\n const flags = ts.getCombinedModifierFlags(methodDecl);\n // eslint-disable-next-line no-bitwise\n const isStatic = Boolean(flags & ts.ModifierFlags.Static);\n const decorators = ts.canHaveDecorators(methodDecl) ? ts.getDecorators(methodDecl) : undefined;\n const hasDecorator = Boolean(decorators?.some(decorator => {\n const name = getDecoratorName(decorator);\n\n return Boolean(name && decoratorNames.has(name));\n }));\n\n const info: MethodInfo = {\n hasDecorator,\n isStatic,\n usesThis: methodUsesThis(methodDecl)\n };\n\n methodCache.set(aliased, info);\n\n return info;\n };\n\n /**\n * Determines whether a symbol should be reported as an unbound method.\n * It resolves aliases and consults cached results to avoid repeated analysis.\n * It evaluates method metadata to ensure only non-static methods that use `this` and lack decorators are flagged.\n *\n * @param symbol The symbol to evaluate for reporting eligibility.\n * @returns True when the symbol represents an unbound method that should be reported.\n *\n * @example\n * ```tsx\n * const shouldReport = shouldReportSymbol(methodSymbol);\n * ```\n */\n const shouldReportSymbol = (symbol: ts.Symbol): boolean => {\n const aliased = resolveSymbol(symbol);\n const cached = reportCache.get(aliased);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const info = getMethodInfo(aliased);\n\n if (!info) {\n reportCache.set(aliased, false);\n\n return false;\n }\n\n const shouldReport = !info.isStatic && info.usesThis && !info.hasDecorator;\n\n reportCache.set(aliased, shouldReport);\n\n return shouldReport;\n };\n\n /**\n * Resolves the TypeScript symbol associated with a member expression node.\n * It caches the resolved symbol to minimize repeated checker lookups.\n * It supports both property access and string-literal element access expressions.\n *\n * @param node The member expression node to resolve into a symbol.\n * @returns The resolved symbol, or null when no symbol can be determined.\n *\n * @example\n * ```tsx\n * const symbol = getSymbolForMember(memberExpression);\n * ```\n */\n const getSymbolForMember = (node: TSESTree.MemberExpression): ts.Symbol | null => {\n const cached = memberSymbolCache.get(node);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const tsNode = services.esTreeNodeToTSNodeMap.get(node);\n\n if (ts.isPropertyAccessExpression(tsNode)) {\n const symbol = checker.getSymbolAtLocation(tsNode.name) ?? null;\n\n memberSymbolCache.set(node, symbol);\n\n return symbol;\n }\n\n if (ts.isElementAccessExpression(tsNode)) {\n const arg = tsNode.argumentExpression;\n\n if (ts.isStringLiteralLike(arg)) {\n const symbol = checker.getSymbolAtLocation(arg) ?? null;\n\n memberSymbolCache.set(node, symbol);\n\n return symbol;\n }\n }\n\n memberSymbolCache.set(node, null);\n\n return null;\n };\n\n /**\n * Reports a constructor binding assignment for a method name.\n * It formats the report data with the decorator label and method name.\n * It delegates to the ESLint context to surface the diagnostic at the provided node.\n *\n * @param methodName The name of the method that was bound in the constructor.\n * @param node The AST node that represents the binding expression.\n *\n * @example\n * ```tsx\n * reportConstructorBinding('handleClick', expressionNode);\n * ```\n */\n const reportConstructorBinding = (methodName: string, node: TSESTree.Node) => {\n context.report({\n data: {\n decoratorName: decoratorLabel,\n methodName\n },\n messageId: 'constructorBind',\n node\n });\n };\n\n const listeners: TSESLint.RuleListener = {\n /**\n * Processes a member expression node to determine whether it represents an unbound method usage that\n * should be reported. It performs multiple early returns based on node shape, parent usage, callback context,\n * binding checks, and symbol eligibility. It ultimately reports a linting issue when all conditions\n * indicate a problematic unbound method reference.\n *\n * @param node The member expression node to analyze for unbound method usage.\n *\n * @example\n * ```tsx\n * MemberExpression(node);\n * ```\n */\n MemberExpression(node: TSESTree.MemberExpression) {\n if (node.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n\n const {parent} = node;\n\n if (\n (parent.type === AST_NODE_TYPES.CallExpression || parent.type === AST_NODE_TYPES.NewExpression)\n && parent.callee === node\n ) {\n return;\n }\n\n if (!isCallbackUsage(node)) {\n return;\n }\n\n if (isThisBindCall(node)) {\n return;\n }\n\n const symbol = getSymbolForMember(node);\n\n if (!symbol) {\n return;\n }\n\n if (!shouldReportSymbol(symbol)) {\n return;\n }\n\n context.report({\n data: {\n decoratorName: decoratorLabel,\n methodName: node.property.name\n },\n messageId: 'unboundMethod',\n node\n });\n },\n /**\n * Inspects constructor method definitions to detect assignments where a class method\n * is bound to `this` via `.bind(this)`, and reports such bindings for further handling.\n *\n * @param node The method definition node to analyze.\n */\n MethodDefinition(node: TSESTree.MethodDefinition) {\n if (node.kind !== 'constructor' || !node.value.body) {\n return;\n }\n\n const constructorBody = node.value.body;\n\n for (const statement of constructorBody.body) {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n continue;\n }\n\n const {expression} = statement;\n\n if (expression.type !== AST_NODE_TYPES.AssignmentExpression || expression.operator !== '=') {\n continue;\n }\n\n const {left, right} = expression;\n\n if (\n left.type !== AST_NODE_TYPES.MemberExpression\n || left.property.type !== AST_NODE_TYPES.Identifier\n ) {\n continue;\n }\n\n if (left.object.type !== AST_NODE_TYPES.ThisExpression) {\n continue;\n }\n\n if (right.type !== AST_NODE_TYPES.CallExpression) {\n continue;\n }\n\n const {callee} = right;\n\n if (callee.type !== AST_NODE_TYPES.MemberExpression) {\n continue;\n }\n\n if (\n callee.object.type !== AST_NODE_TYPES.MemberExpression\n || callee.object.object.type !== AST_NODE_TYPES.ThisExpression\n || callee.object.property.type !== AST_NODE_TYPES.Identifier\n || callee.object.property.name !== left.property.name\n ) {\n continue;\n }\n\n if (\n callee.property.type !== AST_NODE_TYPES.Identifier\n || callee.property.name !== 'bind'\n ) {\n continue;\n }\n\n if (right.arguments.length === 0) {\n continue;\n }\n\n const firstArg = unwrapExpression(right.arguments[0] as TSESTree.Expression);\n\n if (firstArg.type !== AST_NODE_TYPES.ThisExpression) {\n continue;\n }\n\n reportConstructorBinding(left.property.name, expression);\n }\n }\n };\n\n return listeners;\n }\n});"],"names":["createRule","ESLintUtils","RuleCreator","name","noUnboundMethod","defaultOptions","decoratorNames","DEFAULT_DECORATORS","meta","docs","description","messages","constructorBind","unboundMethod","schema","additionalProperties","properties","items","type","uniqueItems","create","context","services","getParserServices","checker","program","getTypeChecker","normalizeDecoratorNames","options","decoratorLabel","Array","from","methodCache","Map","reportCache","aliasCache","memberSymbolCache","resolveSymbol","symbol","cached","get","resolved","flags","ts","SymbolFlags","Alias","getAliasedSymbol","set","getMethodInfo","aliased","Method","Property","Function","GetAccessor","SetAccessor","declarations","getDeclarations","methodDecl","find","decl","isMethodDeclaration","parent","isClassLike","isIdentifier","text","getCombinedModifierFlags","isStatic","Boolean","ModifierFlags","Static","decorators","canHaveDecorators","getDecorators","undefined","hasDecorator","some","decorator","getDecoratorName","has","info","usesThis","methodUsesThis","shouldReportSymbol","shouldReport","getSymbolForMember","node","tsNode","esTreeNodeToTSNodeMap","isPropertyAccessExpression","getSymbolAtLocation","isElementAccessExpression","arg","argumentExpression","isStringLiteralLike","reportConstructorBinding","methodName","report","data","decoratorName","messageId","listeners","MemberExpression","property","AST_NODE_TYPES","Identifier","CallExpression","NewExpression","callee","isCallbackUsage","isThisBindCall","MethodDefinition","kind","value","body","constructorBody","statement","ExpressionStatement","expression","AssignmentExpression","operator","left","right","object","ThisExpression","arguments","length","firstArg","unwrapExpression"],"mappings":";;;;AAeA,MAAMA,YAAU,GAAGC,WAAW,CAACC,WAAW,CACtCC,IAAI,IAAI,CAAA,kEAAA,EAAqEA,IAAI,CAAA,GAAA,CACrF,CAAC;AAcM,MAAMC,eAAe,GAAGJ,YAAU,CAA0B;AAC/DK,EAAAA,cAAc,EAAE,CAAC;AAACC,IAAAA,cAAc,EAAEC;AAAkB,GAAC,CAAC;AACtDC,EAAAA,IAAI,EAAE;AACFC,IAAAA,IAAI,EAAE;AAACC,MAAAA,WAAW,EAAE;KAAyE;AAC7FC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,eAAe,EAAE,2DAA2D;AAC5EC,MAAAA,aAAa,EAAE;KAClB;AACDC,IAAAA,MAAM,EAAE,CACJ;AACIC,MAAAA,oBAAoB,EAAE,KAAK;AAC3BC,MAA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,cAAc,CAACoB,cAAc,IAC3DhB,MAAM,CAACe,MAAM,CAACpB,QAAQ,CAACpF,IAAI,KAAKqF,cAAc,CAACC,UAAU,IACzDG,MAAM,CAACe,MAAM,CAACpB,QAAQ,CAACnG,IAAI,KAAKqH,IAAI,CAAClB,QAAQ,CAACnG,IAAI,EACvD;AACE,YAAA;AACJ,UAAA;AAEA,UAAA,IACIwG,MAAM,CAACL,QAAQ,CAACpF,IAAI,KAAKqF,cAAc,CAACC,UAAU,IAC/CG,MAAM,CAACL,QAAQ,CAACnG,IAAI,KAAK,MAAM,EACpC;AACE,YAAA;AACJ,UAAA;AAEA,UAAA,IAAIsH,KAAK,CAACG,SAAS,CAACC,MAAM,KAAK,CAAC,EAAE;AAC9B,YAAA;AACJ,UAAA;UAEA,MAAMC,QAAQ,GAAGC,gBAAgB,CAACN,KAAK,CAACG,SAAS,CAAC,CAAC,CAAwB,CAAC;AAE5E,UAAA,IAAIE,QAAQ,CAAC5G,IAAI,KAAKqF,cAAc,CAACoB,cAAc,EAAE;AACjD,YAAA;AACJ,UAAA;UAEA7B,wBAAwB,CAAC0B,IAAI,CAAClB,QAAQ,CAACnG,IAAI,EAAEkH,UAAU,CAAC;AAC5D,QAAA;AACJ,MAAA;KACH;AAED,IAAA,OAAOjB,SAAS;AACpB,EAAA;AACJ,CAAC;;;;"}
1
+ {"version":3,"file":"no-unbound-method.js","sources":["../../../../src/rules/custom/no-unbound-method.ts"],"sourcesContent":["import {AST_NODE_TYPES, ESLintUtils} from '@typescript-eslint/utils';\nimport ts from 'typescript';\n\nimport {\n DEFAULT_DECORATORS,\n getDecoratorName,\n isCallbackUsage,\n isThisBindCall,\n methodUsesThis,\n normalizeDecoratorNames,\n unwrapExpression\n} from './utils/no-unbound-method-utils';\n\nimport type {TSESLint, TSESTree} from '@typescript-eslint/utils';\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/nfqde/eslint-config-nfq/blob/master/docs/rules/${name}.md`\n);\n\ntype RuleOptions = [\n {decoratorNames?: string[]}?\n];\n\ntype MessageIds = 'constructorBind' | 'unboundMethod';\n\ntype MethodInfo = {\n autoBind: boolean;\n hasDecorator: boolean;\n isStatic: boolean;\n usesThis: boolean;\n};\n\nexport const noUnboundMethod = createRule<RuleOptions, MessageIds>({\n defaultOptions: [{decoratorNames: DEFAULT_DECORATORS}],\n meta: {\n docs: {description: 'Warn when unbound class methods that use this are passed as callbacks.'},\n messages: {\n constructorBind: 'Do not bind in the constructor; prefer {{decoratorName}}.',\n unboundMethod: 'Method {{methodName}} uses this and is passed unbound. Add {{decoratorName}} or bind it.'\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n decoratorNames: {\n items: {type: 'string'},\n type: 'array',\n uniqueItems: true\n }\n },\n type: 'object'\n }\n ],\n type: 'problem'\n },\n name: 'no-unbound-method',\n /**\n * Creates the rule listeners and initializes caches for symbol analysis.\n * It wires the parser services to the TypeScript type checker and configures decorator handling.\n * It returns ESLint listeners that report unbound method usage in callbacks and constructor binding.\n *\n * @param context Rule context used to access parser services and report issues.\n * @returns The rule listener map for this rule.\n *\n * @example\n * ```tsx\n * const listeners = rule.create(context);\n * ```\n */\n create(context) {\n const services = ESLintUtils.getParserServices(context);\n const checker = services.program.getTypeChecker();\n const decoratorNames = normalizeDecoratorNames(context.options[0]?.decoratorNames);\n const decoratorLabel = `@${Array.from(decoratorNames)[0] ?? 'autobind'}`;\n const methodCache = new Map<ts.Symbol, MethodInfo>();\n const reportCache = new Map<ts.Symbol, boolean>();\n const aliasCache = new Map<ts.Symbol, ts.Symbol>();\n const memberSymbolCache = new Map<TSESTree.MemberExpression, ts.Symbol | null>();\n const classAutoBindCache = new WeakMap<ts.ClassLikeDeclaration, boolean>();\n\n const isAutoBindOption = (node: ts.Expression): boolean => {\n if (!ts.isObjectLiteralExpression(node)) {\n return false;\n }\n\n return node.properties.some(property => {\n if (!ts.isPropertyAssignment(property)) {\n return false;\n }\n\n const name = ts.isIdentifier(property.name)\n ? property.name.text\n : ts.isStringLiteral(property.name)\n ? property.name.text\n : null;\n\n if (name !== 'autoBind') {\n return false;\n }\n\n return property.initializer.kind === ts.SyntaxKind.TrueKeyword;\n });\n };\n\n const isMakeAutoObservableCallee = (node: ts.Expression): boolean => {\n if (ts.isIdentifier(node)) {\n return node.text === 'makeAutoObservable';\n }\n\n return ts.isPropertyAccessExpression(node) && node.name.text === 'makeAutoObservable';\n };\n\n const hasAutoBindInConstructor = (classDecl: ts.ClassLikeDeclaration): boolean => {\n const cached = classAutoBindCache.get(classDecl);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const ctor = classDecl.members.find(member => ts.isConstructorDeclaration(member));\n\n if (!ctor?.body) {\n classAutoBindCache.set(classDecl, false);\n\n return false;\n }\n\n for (const statement of ctor.body.statements) {\n if (!ts.isExpressionStatement(statement)) {\n continue;\n }\n\n const expr = statement.expression;\n\n if (!ts.isCallExpression(expr)) {\n continue;\n }\n\n if (!isMakeAutoObservableCallee(expr.expression)) {\n continue;\n }\n\n if (expr.arguments.length < 2) {\n continue;\n }\n\n if (expr.arguments[0].kind !== ts.SyntaxKind.ThisKeyword) {\n continue;\n }\n\n const hasAutoBind = expr.arguments.slice(1).some(arg => isAutoBindOption(arg));\n\n if (hasAutoBind) {\n classAutoBindCache.set(classDecl, true);\n\n return true;\n }\n }\n\n classAutoBindCache.set(classDecl, false);\n\n return false;\n };\n\n /**\n * Resolves an alias symbol to its original symbol and caches the result for reuse.\n * This function avoids repeated TypeScript checker work by memoizing alias resolutions.\n * It ensures downstream analysis consistently uses the same canonical symbol instance.\n *\n * @param symbol The symbol that may be an alias and needs resolution.\n * @returns The resolved canonical symbol for further analysis.\n *\n * @example\n * ```tsx\n * const resolved = resolveSymbol(methodSymbol);\n * ```\n */\n const resolveSymbol = (symbol: ts.Symbol): ts.Symbol => {\n const cached = aliasCache.get(symbol);\n\n if (cached) {\n return cached;\n }\n\n // eslint-disable-next-line no-bitwise\n const resolved = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;\n\n aliasCache.set(symbol, resolved);\n\n return resolved;\n };\n\n /**\n * Computes metadata about a method-like symbol and caches the result for later use.\n * This function filters out non-method symbols and constructor declarations before gathering details.\n * It also determines decorator presence, static status, and whether the method uses `this`.\n *\n * @param symbol The symbol to inspect for method information.\n * @returns The resolved method info or null when the symbol is not a supported method.\n *\n * @example\n * ```tsx\n * const info = getMethodInfo(methodSymbol);\n * ```\n */\n const getMethodInfo = (symbol: ts.Symbol): MethodInfo | null => {\n const aliased = resolveSymbol(symbol);\n const cached = methodCache.get(aliased);\n\n if (cached) {\n return cached;\n }\n\n if (!(\n // eslint-disable-next-line no-bitwise\n aliased.flags\n & (\n // eslint-disable-next-line no-bitwise\n ts.SymbolFlags.Method\n | ts.SymbolFlags.Property\n | ts.SymbolFlags.Function\n | ts.SymbolFlags.GetAccessor\n | ts.SymbolFlags.SetAccessor\n )\n )) {\n return null;\n }\n\n const declarations = aliased.getDeclarations() ?? [];\n const methodDecl = declarations\n .find(decl => ts.isMethodDeclaration(decl));\n\n if (!methodDecl?.parent || !ts.isClassLike(methodDecl.parent)) {\n return null;\n }\n\n if (ts.isIdentifier(methodDecl.name) && methodDecl.name.text === 'constructor') {\n return null;\n }\n\n const flags = ts.getCombinedModifierFlags(methodDecl);\n // eslint-disable-next-line no-bitwise\n const isStatic = Boolean(flags & ts.ModifierFlags.Static);\n const decorators = ts.canHaveDecorators(methodDecl) ? ts.getDecorators(methodDecl) : undefined;\n const hasDecorator = Boolean(decorators?.some(decorator => {\n const name = getDecoratorName(decorator);\n\n return Boolean(name && decoratorNames.has(name));\n }));\n\n const info: MethodInfo = {\n autoBind: hasAutoBindInConstructor(methodDecl.parent),\n hasDecorator,\n isStatic,\n usesThis: methodUsesThis(methodDecl)\n };\n\n methodCache.set(aliased, info);\n\n return info;\n };\n\n /**\n * Determines whether a symbol should be reported as an unbound method.\n * It resolves aliases and consults cached results to avoid repeated analysis.\n * It evaluates method metadata to ensure only non-static methods that use `this` and lack decorators are flagged.\n *\n * @param symbol The symbol to evaluate for reporting eligibility.\n * @returns True when the symbol represents an unbound method that should be reported.\n *\n * @example\n * ```tsx\n * const shouldReport = shouldReportSymbol(methodSymbol);\n * ```\n */\n const shouldReportSymbol = (symbol: ts.Symbol): boolean => {\n const aliased = resolveSymbol(symbol);\n const cached = reportCache.get(aliased);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const info = getMethodInfo(aliased);\n\n if (!info) {\n reportCache.set(aliased, false);\n\n return false;\n }\n\n const shouldReport = !info.autoBind && !info.isStatic && info.usesThis && !info.hasDecorator;\n\n reportCache.set(aliased, shouldReport);\n\n return shouldReport;\n };\n\n /**\n * Resolves the TypeScript symbol associated with a member expression node.\n * It caches the resolved symbol to minimize repeated checker lookups.\n * It supports both property access and string-literal element access expressions.\n *\n * @param node The member expression node to resolve into a symbol.\n * @returns The resolved symbol, or null when no symbol can be determined.\n *\n * @example\n * ```tsx\n * const symbol = getSymbolForMember(memberExpression);\n * ```\n */\n const getSymbolForMember = (node: TSESTree.MemberExpression): ts.Symbol | null => {\n const cached = memberSymbolCache.get(node);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const tsNode = services.esTreeNodeToTSNodeMap.get(node);\n\n if (ts.isPropertyAccessExpression(tsNode)) {\n const symbol = checker.getSymbolAtLocation(tsNode.name) ?? null;\n\n memberSymbolCache.set(node, symbol);\n\n return symbol;\n }\n\n if (ts.isElementAccessExpression(tsNode)) {\n const arg = tsNode.argumentExpression;\n\n if (ts.isStringLiteralLike(arg)) {\n const symbol = checker.getSymbolAtLocation(arg) ?? null;\n\n memberSymbolCache.set(node, symbol);\n\n return symbol;\n }\n }\n\n memberSymbolCache.set(node, null);\n\n return null;\n };\n\n /**\n * Reports a constructor binding assignment for a method name.\n * It formats the report data with the decorator label and method name.\n * It delegates to the ESLint context to surface the diagnostic at the provided node.\n *\n * @param methodName The name of the method that was bound in the constructor.\n * @param node The AST node that represents the binding expression.\n *\n * @example\n * ```tsx\n * reportConstructorBinding('handleClick', expressionNode);\n * ```\n */\n const reportConstructorBinding = (methodName: string, node: TSESTree.Node) => {\n context.report({\n data: {\n decoratorName: decoratorLabel,\n methodName\n },\n messageId: 'constructorBind',\n node\n });\n };\n\n const listeners: TSESLint.RuleListener = {\n /**\n * Processes a member expression node to determine whether it represents an unbound method usage that\n * should be reported. It performs multiple early returns based on node shape, parent usage, callback context,\n * binding checks, and symbol eligibility. It ultimately reports a linting issue when all conditions\n * indicate a problematic unbound method reference.\n *\n * @param node The member expression node to analyze for unbound method usage.\n *\n * @example\n * ```tsx\n * MemberExpression(node);\n * ```\n */\n MemberExpression(node: TSESTree.MemberExpression) {\n if (node.property.type !== AST_NODE_TYPES.Identifier) {\n return;\n }\n\n const {parent} = node;\n\n if (\n (parent.type === AST_NODE_TYPES.CallExpression || parent.type === AST_NODE_TYPES.NewExpression)\n && parent.callee === node\n ) {\n return;\n }\n\n if (!isCallbackUsage(node)) {\n return;\n }\n\n if (isThisBindCall(node)) {\n return;\n }\n\n const symbol = getSymbolForMember(node);\n\n if (!symbol) {\n return;\n }\n\n if (!shouldReportSymbol(symbol)) {\n return;\n }\n\n context.report({\n data: {\n decoratorName: decoratorLabel,\n methodName: node.property.name\n },\n messageId: 'unboundMethod',\n node\n });\n },\n /**\n * Inspects constructor method definitions to detect assignments where a class method\n * is bound to `this` via `.bind(this)`, and reports such bindings for further handling.\n *\n * @param node The method definition node to analyze.\n */\n MethodDefinition(node: TSESTree.MethodDefinition) {\n if (node.kind !== 'constructor' || !node.value.body) {\n return;\n }\n\n const constructorBody = node.value.body;\n\n for (const statement of constructorBody.body) {\n if (statement.type !== AST_NODE_TYPES.ExpressionStatement) {\n continue;\n }\n\n const {expression} = statement;\n\n if (expression.type !== AST_NODE_TYPES.AssignmentExpression || expression.operator !== '=') {\n continue;\n }\n\n const {left, right} = expression;\n\n if (\n left.type !== AST_NODE_TYPES.MemberExpression\n || left.property.type !== AST_NODE_TYPES.Identifier\n ) {\n continue;\n }\n\n if (left.object.type !== AST_NODE_TYPES.ThisExpression) {\n continue;\n }\n\n if (right.type !== AST_NODE_TYPES.CallExpression) {\n continue;\n }\n\n const {callee} = right;\n\n if (callee.type !== AST_NODE_TYPES.MemberExpression) {\n continue;\n }\n\n if (\n callee.object.type !== AST_NODE_TYPES.MemberExpression\n || callee.object.object.type !== AST_NODE_TYPES.ThisExpression\n || callee.object.property.type !== AST_NODE_TYPES.Identifier\n || callee.object.property.name !== left.property.name\n ) {\n continue;\n }\n\n if (\n callee.property.type !== AST_NODE_TYPES.Identifier\n || callee.property.name !== 'bind'\n ) {\n continue;\n }\n\n if (right.arguments.length === 0) {\n continue;\n }\n\n const firstArg = unwrapExpression(right.arguments[0] as TSESTree.Expression);\n\n if (firstArg.type !== AST_NODE_TYPES.ThisExpression) {\n continue;\n }\n\n reportConstructorBinding(left.property.name, expression);\n }\n }\n };\n\n return listeners;\n }\n});"],"names":["createRule","ESLintUtils","RuleCreator","name","noUnboundMethod","defaultOptions","decoratorNames","DEFAULT_DECORATORS","meta","docs","description","messages","constructorBind","unboundMethod","schema","additionalProperties","properties","items","type","uniqueItems","create","context","services","getParserServices","checker","program","getTypeChecker","normalizeDecoratorNames","options","decoratorLabel","Array","from","methodCache","Map","reportCache","aliasCache","memberSymbolCache","classAutoBindCache","WeakMap","isAutoBindOption","node","ts","isObjectLiteralExpression","some","property","isPropertyAssignment","isIdentifier","text","isStringLiteral","initializer","kind","SyntaxKind","TrueKeyword","isMakeAutoObservableCallee","isPropertyAccessExpression","hasAutoBindInConstructor","classDecl","cached","get","undefined","ctor","members","find","member","isConstructorDeclaration","body","set","statement","statements","isExpressionStatement","expr","expression","isCallExpression","arguments","length","ThisKeyword","hasAutoBind","slice","arg","resolveSymbol","symbol","resolved","flags","SymbolFlags","Alias","getAliasedSymbol","getMethodInfo","aliased","Method","Property","Function","GetAccessor","SetAccessor","declarations","getDeclarations","methodDecl","decl","isMethodDeclaration","parent","isClassLike","getCombinedModifierFlags","isStatic","Boolean","ModifierFlags","Static","decorators","canHaveDecorators","getDecorators","hasDecorator","decorator","getDecoratorName","has","info","autoBind","usesThis","methodUsesThis","shouldReportSymbol","shouldReport","getSymbolForMember","tsNode","esTreeNodeToTSNodeMap","getSymbolAtLocation","isElementAccessExpression","argumentExpression","isStringLiteralLike","reportConstructorBinding","methodName","report","data","decoratorName","messageId","listeners","MemberExpression","AST_NODE_TYPES","Identifier","CallExpression","NewExpression","callee","isCallbackUsage","isThisBindCall","MethodDefinition","value","constructorBody","ExpressionStatement","AssignmentExpression","operator","left","right","object","ThisExpression","firstArg","unwrapExpression"],"mappings":";;;;AAeA,MAAMA,YAAU,GAAGC,WAAW,CAACC,WAAW,CACtCC,IAAI,IAAI,CAAA,kEAAA,EAAqEA,IAAI,CAAA,GAAA,CACrF,CAAC;AAeM,MAAMC,eAAe,GAAGJ,YAAU,CAA0B;AAC/DK,EAAAA,cAAc,EAAE,CAAC;AAACC,IAAAA,cAAc,EAAEC;AAAkB,GAAC,CAAC;AACtDC,EAAAA,IAAI,EAAE;AACFC,IAAAA,IAAI,EAAE;AAACC,MAAAA,WAAW,EAAE;KAAyE;AAC7FC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,eAAe,EAAE,2DAA2D;AAC5EC,MAAAA,aAAa,EAAE;KAClB;AACDC,IAAAA,MAAM,EAAE,CACJ;AACIC,MAAAA,oBAAoB,EAAE,KAAK;AAC3BC,MAAAA,UAAU,EAAE;AACRV,QAAAA,cAAc,EAAE;AACZW,UAAAA,KAAK,EAAE;AAACC,YAAAA,IAAI,EAAE;WAAS;AACvBA,UAAAA,IAAI,EAAE,OAAO;AACbC,UAAAA,WAAW,EAAE;AACjB;OACH;AACDD,MAAAA,IAAI,EAAE;AACV,KAAC,CACJ;AACDA,IAAAA,IAAI,EAAE;GACT;AACDf,EAAAA,IAAI,EAAE,mBAAmB;EAczBiB,MAAMA,CAACC,OAAO,EAAE;AACZ,IAAA,MAAMC,QAAQ,GAAGrB,WAAW,CAACsB,iBA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mH,cAAc,CAACgB,cAAc,IAC3DZ,MAAM,CAACW,MAAM,CAACxG,QAAQ,CAAC1B,IAAI,KAAKmH,cAAc,CAACC,UAAU,IACzDG,MAAM,CAACW,MAAM,CAACxG,QAAQ,CAACzC,IAAI,KAAK+I,IAAI,CAACtG,QAAQ,CAACzC,IAAI,EACvD;AACE,YAAA;AACJ,UAAA;AAEA,UAAA,IACIsI,MAAM,CAAC7F,QAAQ,CAAC1B,IAAI,KAAKmH,cAAc,CAACC,UAAU,IAC/CG,MAAM,CAAC7F,QAAQ,CAACzC,IAAI,KAAK,MAAM,EACpC;AACE,YAAA;AACJ,UAAA;AAEA,UAAA,IAAIgJ,KAAK,CAAC1E,SAAS,CAACC,MAAM,KAAK,CAAC,EAAE;AAC9B,YAAA;AACJ,UAAA;UAEA,MAAM4E,QAAQ,GAAGC,gBAAgB,CAACJ,KAAK,CAAC1E,SAAS,CAAC,CAAC,CAAwB,CAAC;AAE5E,UAAA,IAAI6E,QAAQ,CAACpI,IAAI,KAAKmH,cAAc,CAACgB,cAAc,EAAE;AACjD,YAAA;AACJ,UAAA;UAEAxB,wBAAwB,CAACqB,IAAI,CAACtG,QAAQ,CAACzC,IAAI,EAAEoE,UAAU,CAAC;AAC5D,QAAA;AACJ,MAAA;KACH;AAED,IAAA,OAAO4D,SAAS;AACpB,EAAA;AACJ,CAAC;;;;"}
@@ -0,0 +1,14 @@
1
+ const storybookResets = {
2
+ '@nfq/component-file-structure': 'off',
3
+ '@stylistic/newline-per-chained-call': 'off',
4
+ '@typescript-eslint/no-unused-expression': 'off',
5
+ '@typescript-eslint/no-unused-expressions': 'off',
6
+ 'max-lines': 'off',
7
+ 'promise/always-return': 'off',
8
+ 'promise/catch-or-return': 'off',
9
+ 'promise/prefer-await-to-callbacks': 'off',
10
+ 'promise/prefer-await-to-then': 'off'
11
+ };
12
+
13
+ export { storybookResets };
14
+ //# sourceMappingURL=resets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resets.js","sources":["../../../../../src/rules/storybook/overrides/resets.ts"],"sourcesContent":["export const storybookResets = {\n '@nfq/component-file-structure': 'off',\n '@stylistic/newline-per-chained-call': 'off',\n '@typescript-eslint/no-unused-expression': 'off',\n '@typescript-eslint/no-unused-expressions': 'off',\n 'max-lines': 'off',\n 'promise/always-return': 'off',\n 'promise/catch-or-return': 'off',\n 'promise/prefer-await-to-callbacks': 'off',\n 'promise/prefer-await-to-then': 'off'\n};"],"names":["storybookResets"],"mappings":"AAAO,MAAMA,eAAe,GAAG;AAC3B,EAAA,+BAA+B,EAAE,KAAK;AACtC,EAAA,qCAAqC,EAAE,KAAK;AAC5C,EAAA,yCAAyC,EAAE,KAAK;AAChD,EAAA,0CAA0C,EAAE,KAAK;AACjD,EAAA,WAAW,EAAE,KAAK;AAClB,EAAA,uBAAuB,EAAE,KAAK;AAC9B,EAAA,yBAAyB,EAAE,KAAK;AAChC,EAAA,mCAAmC,EAAE,KAAK;AAC1C,EAAA,8BAA8B,EAAE;AACpC;;;;"}
package/dist/index.js CHANGED
@@ -1653,6 +1653,18 @@ const tsRules = {
1653
1653
  ...nfqRules
1654
1654
  };
1655
1655
 
1656
+ const storybookResets = {
1657
+ '@nfq/component-file-structure': 'off',
1658
+ '@stylistic/newline-per-chained-call': 'off',
1659
+ '@typescript-eslint/no-unused-expression': 'off',
1660
+ '@typescript-eslint/no-unused-expressions': 'off',
1661
+ 'max-lines': 'off',
1662
+ 'promise/always-return': 'off',
1663
+ 'promise/catch-or-return': 'off',
1664
+ 'promise/prefer-await-to-callbacks': 'off',
1665
+ 'promise/prefer-await-to-then': 'off'
1666
+ };
1667
+
1656
1668
  const globals = {
1657
1669
  after: false,
1658
1670
  afterEach: false,
@@ -3883,6 +3895,64 @@ const noUnboundMethod = createRule$4({
3883
3895
  const reportCache = new Map();
3884
3896
  const aliasCache = new Map();
3885
3897
  const memberSymbolCache = new Map();
3898
+ const classAutoBindCache = new WeakMap();
3899
+ const isAutoBindOption = node => {
3900
+ if (!ts__default.default.isObjectLiteralExpression(node)) {
3901
+ return false;
3902
+ }
3903
+ return node.properties.some(property => {
3904
+ if (!ts__default.default.isPropertyAssignment(property)) {
3905
+ return false;
3906
+ }
3907
+ const name = ts__default.default.isIdentifier(property.name) ? property.name.text : ts__default.default.isStringLiteral(property.name) ? property.name.text : null;
3908
+ if (name !== 'autoBind') {
3909
+ return false;
3910
+ }
3911
+ return property.initializer.kind === ts__default.default.SyntaxKind.TrueKeyword;
3912
+ });
3913
+ };
3914
+ const isMakeAutoObservableCallee = node => {
3915
+ if (ts__default.default.isIdentifier(node)) {
3916
+ return node.text === 'makeAutoObservable';
3917
+ }
3918
+ return ts__default.default.isPropertyAccessExpression(node) && node.name.text === 'makeAutoObservable';
3919
+ };
3920
+ const hasAutoBindInConstructor = classDecl => {
3921
+ const cached = classAutoBindCache.get(classDecl);
3922
+ if (cached !== undefined) {
3923
+ return cached;
3924
+ }
3925
+ const ctor = classDecl.members.find(member => ts__default.default.isConstructorDeclaration(member));
3926
+ if (!ctor?.body) {
3927
+ classAutoBindCache.set(classDecl, false);
3928
+ return false;
3929
+ }
3930
+ for (const statement of ctor.body.statements) {
3931
+ if (!ts__default.default.isExpressionStatement(statement)) {
3932
+ continue;
3933
+ }
3934
+ const expr = statement.expression;
3935
+ if (!ts__default.default.isCallExpression(expr)) {
3936
+ continue;
3937
+ }
3938
+ if (!isMakeAutoObservableCallee(expr.expression)) {
3939
+ continue;
3940
+ }
3941
+ if (expr.arguments.length < 2) {
3942
+ continue;
3943
+ }
3944
+ if (expr.arguments[0].kind !== ts__default.default.SyntaxKind.ThisKeyword) {
3945
+ continue;
3946
+ }
3947
+ const hasAutoBind = expr.arguments.slice(1).some(arg => isAutoBindOption(arg));
3948
+ if (hasAutoBind) {
3949
+ classAutoBindCache.set(classDecl, true);
3950
+ return true;
3951
+ }
3952
+ }
3953
+ classAutoBindCache.set(classDecl, false);
3954
+ return false;
3955
+ };
3886
3956
  const resolveSymbol = symbol => {
3887
3957
  const cached = aliasCache.get(symbol);
3888
3958
  if (cached) {
@@ -3917,6 +3987,7 @@ const noUnboundMethod = createRule$4({
3917
3987
  return Boolean(name && decoratorNames.has(name));
3918
3988
  }));
3919
3989
  const info = {
3990
+ autoBind: hasAutoBindInConstructor(methodDecl.parent),
3920
3991
  hasDecorator,
3921
3992
  isStatic,
3922
3993
  usesThis: methodUsesThis(methodDecl)
@@ -3935,7 +4006,7 @@ const noUnboundMethod = createRule$4({
3935
4006
  reportCache.set(aliased, false);
3936
4007
  return false;
3937
4008
  }
3938
- const shouldReport = !info.isStatic && info.usesThis && !info.hasDecorator;
4009
+ const shouldReport = !info.autoBind && !info.isStatic && info.usesThis && !info.hasDecorator;
3939
4010
  reportCache.set(aliased, shouldReport);
3940
4011
  return shouldReport;
3941
4012
  };
@@ -4959,6 +5030,35 @@ const NFQEslintConfig = [settings, {
4959
5030
  ...tsRules,
4960
5031
  ...typescriptRuleResets
4961
5032
  }
5033
+ }, {
5034
+ files: ['**/*.stories.{ts,cts,mts,tsx}'],
5035
+ languageOptions: {
5036
+ ecmaVersion: 'latest',
5037
+ globals,
5038
+ parser: tsParser__namespace,
5039
+ parserOptions: {
5040
+ ecmaFeatures: {
5041
+ jsx: true
5042
+ },
5043
+ ecmaVersion: 'latest',
5044
+ project: '**/tsconfig*.json'
5045
+ }
5046
+ },
5047
+ linterOptions: {
5048
+ reportUnusedDisableDirectives: 'error',
5049
+ reportUnusedInlineConfigs: 'error'
5050
+ },
5051
+ name: 'NFQ ESLint TS Story Config',
5052
+ plugins: tsPlugins,
5053
+ rules: {
5054
+ ...commonEslintRules,
5055
+ ...commonPluginRules,
5056
+ ...nodeRules,
5057
+ ...reactPluginRules,
5058
+ ...tsRules,
5059
+ ...typescriptRuleResets,
5060
+ ...storybookResets
5061
+ }
4962
5062
  }, {
4963
5063
  files: ['**/*.cy.{ts,cts,mts,tsx}'],
4964
5064
  languageOptions: {