Skip to content

Conversation

@conarti
Copy link
Owner

@conarti conarti commented Dec 7, 2024

Hi! If you’d like to test the new version of the plugin with me, you’re welcome to join. Feel free to report any issues in this PR.

Usage:

  1. Install the new package:
    npm i -D @conarti/eslint-plugin-feature-sliced@next
  2. Set up in eslint.config.js:
import featureSliced from '@conarti/eslint-plugin-feature-sliced';

export default [
  featureSliced(), // By default, uses the "recommended" config from v1. Please refer to the "README" for detailed setup.
];

Planned tasks before publishing the stable version:

  • Add support for eslint v9
  • Add factory function for simpler usage
  • Add @x support
  • Add documentation for the new setup
  • Add documentation for the old setup
  • Add notes about steiger in docs
  • Use better build flow (use any builder)
  • Use better eslint config
  • Set up a better publishing flow, remove unnecessary 'scripts', try to use github releases and github ci for tests, publish and releases
  • Specify correct eslint versions in peerDependencies and check other fields in package.json
  • Ensure that the new version cannot be installed on projects using eslint <=8
  • Fix usage with the tseslint.config(...) factory
  • Test the package in as many projects as possible and fix newly discovered issues

This was linked to issues Dec 7, 2024
@conarti conarti mentioned this pull request Dec 7, 2024
@iksent
Copy link

iksent commented Jul 4, 2025

Hello! How to solve this issue?

ESLint: 9.30.1 - TypeError: featureSliced is not a function

esling.config.js:

const js = require('@eslint/js');
const { FlatCompat } = require('@eslint/eslintrc');
const { defineConfig } = require('eslint/config');
const featureSliced = require('@conarti/eslint-plugin-feature-sliced');

const compat = new FlatCompat({
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all,
});

module.exports = defineConfig([
  featureSliced(),
  {
    ignores: ['config/**/*', '**/*.stories.tsx', 'openapi-typescript/**/*'],
  },
  ...

@conarti
Copy link
Owner Author

conarti commented Sep 17, 2025

@iksent Hello. You have to use @next version

conarti and others added 4 commits September 17, 2025 14:21
- Add RULE_NAMES constants to config for better maintainability
- Remove utils.ts and move rule naming to config
- Simplify create-plugin by removing enhanceWithImportOrder
- Remove mergeConfigs dependency
- Add import-order rule to main plugin rules
- Update all import-order configs to use RULE_NAMES constants
- Improve type safety and developer experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Create rules/import-order/configs.ts with centralized rule configurations
- Remove duplicate configurations from configs/import-order files
- Update create-plugin to use direct rule configs instead of extracting from configs
- Remove shared.ts as it's no longer needed
- Improve DRY principle and maintainability
- Ensure single source of truth for import-order rule configurations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update import-order config names to use proper plugin namespace
- Change from @conarti/sort-imports/* to @conarti/feature-sliced/import-order/*
- Maintain consistency with plugin naming convention

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
conarti and others added 16 commits September 30, 2025 13:20
…name

Fixed bug where rules did not catch imports from segments of other layers
when the slice name was the same in both layers.

The isSameSlice check now properly includes layer verification by reusing
the isSameLayer variable, preventing false positives like:
- pages/policies importing from entities/policies/api
- pages/policies importing from entities/policies/lib

Added test cases for both layers-slices and public-api rules to ensure
cross-layer imports with same slice names are properly caught.

Closes #18

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Updated all test files to use the new ESLint v9 flat config format:
- Changed parserOptions to languageOptions in all test files
- Updated parser from require.resolve() to require()
- Updated ESLint config test to use overrideConfigFile and overrideConfig
- Updated config-lib utility to generate flat config format

All 193 tests now pass successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replaced deprecated TSESLint.RuleTester with @typescript-eslint/rule-tester
- Fixed TypeScript type compatibility issues with type assertions
- All type checks now pass successfully
- Tests remain functional with proper flat config support

This resolves the deprecation warnings and ensures compatibility with ESLint v9.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replaced custom RuleModule interface with official RuleModule<MessageIds, Options>
- Removed 'as any' casts from test files by using correct type signature
- Fixed type inference in public-api tests by removing explicit type annotation

This ensures full type safety and compatibility with @typescript-eslint/rule-tester.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Rewrote tests to use relative paths instead of alias imports
- Removed dependency on CWD_MOCK_PATH for critical business logic tests
- Added separate skipped test suite for cwd functionality
- All 41 tests now pass, 2 tests skipped pending @typescript-eslint/rule-tester cwd support

The skipped tests verify that rules work correctly with custom cwd and alias resolution,
which is currently not supported by @typescript-eslint/rule-tester.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Updated skipped test comment with link to the upstream issue requesting
custom cwd support in @typescript-eslint/rule-tester.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Rewrote tests to remove dependency on custom cwd for critical tests
- Removed tests with absolute file paths that rely on cwd resolution
- Added separate skipped test suites for cwd-dependent functionality
- Fixed setValidationLevel helper to include required ignoreInFilesPatterns field

Changes:
- absolute-relative: removed 4 cwd-dependent tests, added skipped suite with those tests
- public-api: removed 2 cwd-dependent tests, added skipped suite, fixed Options type in helper

All tests now pass (187 passed, 8 skipped total across all rules).

The skipped tests verify functionality with custom cwd and alias resolution,
currently not supported by @typescript-eslint/rule-tester.
See: typescript-eslint/typescript-eslint#11668

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove explicit ESLint.Plugin type that conflicts with @typescript-eslint/utils strict typing. TypeScript now infers the correct type automatically, eliminating the need for type assertions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…ions

When converting imports like `@/entities/node/api.ts` to public API format,
the rule was incorrectly suggesting `@/entities/node.ts` instead of the
correct `@/entities/node`.

This happened because after removing the segment path (e.g., `/api`),
the file extension `.ts` remained in the resulting path.

Solution: Strip common file extensions (.ts, .js, .tsx, .jsx, etc.)
from the final public API path after removing the segment.

Fixes #17

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace hardcoded list of file extensions with a universal regex pattern
that removes any file extension (.xxx format) from directory paths.

This makes the rule work with any file type (.svelte, .astro, .php, etc.)
instead of being limited to specific extensions.

Changed from: /\.(ts|js|tsx|jsx|mts|cts|mjs|cjs|vue)$/
Changed to: /\.\w+$/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix public-api rule: Remove file extensions when suggesting directory imports eslint v9 config support Eslint flat config

3 participants