Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3563,7 +3563,7 @@ function trimJsxText(original: string): string | null {
let lastNonEmptyLine = 0;

for (let i = 0; i < lines.length; i++) {
if (lines[i].match(/[^ \t]/)) {
if (lines[i].trim().length > 0) {
lastNonEmptyLine = i;
}
}
Expand Down
54 changes: 27 additions & 27 deletions packages/eslint-plugin-react-hooks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,43 @@
const plugins = ['react-hooks'];

type ReactHooksFlatConfig = {
plugins: {react: any};
plugins: {'react-hooks': typeof plugin};
rules: Linter.RulesRecord;
};

const configs = {
recommended: {
plugins,
rules: recommendedRuleConfigs,
},
'recommended-latest': {
plugins,
rules: recommendedLatestRuleConfigs,
},
flat: {} as {
recommended: ReactHooksFlatConfig;
'recommended-latest': ReactHooksFlatConfig;
},
};

const plugin = {

Check failure on line 65 in packages/eslint-plugin-react-hooks/src/index.ts

View workflow job for this annotation

GitHub Actions / yarn build and lint (2, experimental)

'plugin' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

Check failure on line 65 in packages/eslint-plugin-react-hooks/src/index.ts

View workflow job for this annotation

GitHub Actions / yarn build and lint (21, stable)

'plugin' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
meta: {
name: 'eslint-plugin-react-hooks',
version: '7.0.0',
},
rules,
configs,
configs: {
recommended: {
plugins,
rules: recommendedRuleConfigs,
},
'recommended-latest': {
plugins,
rules: recommendedLatestRuleConfigs,
},
flat: {
recommended: {
plugins: {'react-hooks': null as unknown as typeof plugin},
rules: recommendedRuleConfigs,
},
'recommended-latest': {
plugins: {'react-hooks': null as unknown as typeof plugin},
rules: recommendedLatestRuleConfigs,
},
} as {
recommended: ReactHooksFlatConfig;
'recommended-latest': ReactHooksFlatConfig;
},
},
};

Object.assign(configs.flat, {
'recommended-latest': {
plugins: {'react-hooks': plugin},
rules: configs['recommended-latest'].rules,
},
recommended: {
plugins: {'react-hooks': plugin},
rules: configs.recommended.rules,
},
});
// Assign the plugin reference after plugin object is created
plugin.configs.flat.recommended.plugins['react-hooks'] = plugin;
plugin.configs.flat['recommended-latest'].plugins['react-hooks'] = plugin;

export default plugin;
Loading