conarti / eslint-plugin-feature-sliced Goto Github PK
View Code? Open in Web Editor NEWFeature sliced design eslint plugin
Feature sliced design eslint plugin
FSD docs suggest renaming layers if they conflict with other tools (e.g. next.js), would be nice to have an option for that.
Reproduction: https://stackblitz.com/edit/remix-run-remix-wvf8xu?file=app%2Fentities%2Fbad%2Findex.ts
// File: entities/bad/index.ts
export { bad } from './lib/bad';
The linter gives the following error:
Absolute imports are only allowed from public api ("./lib")
conarti-fsd/public-api
This forces me to create an index.ts
in ./lib
as well, even though these are optional according to the FSD spec.
Please provide example how to use this plugin with modern eslint flat config.
Still can't achive public-api rule to work.
// @ts-check
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
import eslintFeatureSliced from '@conarti/eslint-plugin-feature-sliced';
import eslintFeatureSlicedOrder from '@conarti/eslint-plugin-feature-sliced/import-order';
import * as eslintPluginImport from 'eslint-plugin-import';
import globals from 'globals';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: ['./packages/*/tsconfig.json'],
// project: true,
tsconfigRootDir: import.meta.dirname,
},
globals: { ...globals.browser },
},
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
react: eslintPluginReact,
'react-hooks': eslintPluginReactHooks,
'@conarti/feature-sliced': eslintFeatureSliced,
import: eslintPluginImport,
},
rules: {
...eslintPluginReact.configs['jsx-runtime'].rules,
...eslintPluginReactHooks.configs.recommended.rules,
...eslintFeatureSlicedOrder.configs.recommended.rules,
...eslintFeatureSliced.configs.rules.rules,
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
},
},
eslintConfigPrettier, // dissable conflicting rules
{
ignores: [
'**/node_modules',
'eslint.config.js',
'**/vite.config.ts',
'**/assets',
'**/autogenerated',
'packages/api-client/index.d.ts',
'packages/api-client/openapi-config.ts',
],
},
);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.