productive-eslint
Version:
Mildly strict and sufficiently practical ESLint config based on Evgeny Orekhov's eslint-config-hardcore
1 lines • 2.71 kB
JavaScript
import e from"eslint-plugin-boundaries";const t=Symbol.for(`productive-eslint.config`),n=e=>(Object.defineProperty(e,t,{configurable:!1,enumerable:!1,value:!0,writable:!1}),e),r=e=>{if(!e||typeof e!=`object`)return!1;let n=e;return n[t]===!0&&typeof n.append==`function`&&typeof n.override==`function`&&typeof n.toConfigs==`function`},i=`@(ts|tsx|mts)`,a=`**/*.${i}`,o=`**/*.@(ts|mts)`,s=`**/*.tsx`,c=`**/*.vue`,l=`**/*.json`,u=`**/*.json5`,d=`**/*.jsonc`,f=`**/*.y?(a)ml`,p=`**/*.toml`,m=`**/*.css`;`${i}`,`${i}`,`${i}`,`${i}`,`${i}`;const h=`**/node_modules,**/dist,**/package-lock.json,**/yarn.lock,**/pnpm-lock.yaml,**/bun.lockb,**/output,**/coverage,**/temp,**/tmp,**/.temp,**/.tmp,**/.history,**/.vitepress/cache,**/.nuxt,**/.next,**/.svelte-kit,**/.vercel,**/.changeset,**/.idea,**/.cache,**/.output,**/.vite-inspect,**/.yarn,**/*.min.*,**/LICENSE*,**/__snapshots__,**/auto-import?(s).d.ts,**/components.d.ts,**/*.d.ts`.split(`,`),g=[{pattern:`app`,type:`app`},{capture:[`page`],pattern:`pages/*`,type:`pages`},{capture:[`widget`],pattern:`widgets/*`,type:`widgets`},{capture:[`feature`],pattern:`features/*`,type:`features`},{capture:[`entity`],pattern:`entities/*`,type:`entities`},{capture:[`segment`],pattern:`shared/*`,type:`shared`}],_=[`pages`,`widgets`,`features`,`entities`,`shared`],v=[`!(index).{ts,tsx,mts,vue}`,`**/!(index).{ts,tsx,mts,vue}`,`**/*/index.{ts,tsx,mts,vue}`],y={"boundaries/elements":[...g],"boundaries/include":[`src/**/*`],"import/resolver":{typescript:{alwaysTryTypes:!0}}},b={name:`boundaries`,plugins:{boundaries:e},settings:y},x=[`error`,{default:`disallow`,rules:[{allow:{to:{type:[`pages`,`widgets`,`features`,`entities`,`shared`]}},from:{type:`app`}},{allow:{to:{type:[`widgets`,`features`,`entities`,`shared`]}},from:{type:`pages`}},{allow:{to:{type:[`features`,`entities`,`shared`]}},from:{type:`widgets`}},{allow:{to:{type:[`entities`,`shared`]}},from:{type:`features`}},{allow:{to:{type:[`shared`]}},from:{type:`entities`}},{allow:{to:{type:[`shared`]}},from:{type:`shared`}},{disallow:{to:{internalPath:[...v]}},message:`private-entry`,to:{type:[..._]}}]}],S=e=>e.replaceAll(`\\`,`/`).replace(/^[./]+/u,``),C=e=>{let t=e.match(/(?:^|\/)(app|pages|widgets|features|entities|shared)(?:\/([^/]+))?/u);if(!t)return null;let[,n,r]=t;return{normalizedPath:e,...n===`app`?{}:{elementName:r},type:n}},w=e=>C(S(e)),T=(e,t)=>e.type===t.type&&e.elementName&&t.elementName&&e.elementName!==t.elementName&&[`entities`,`features`,`pages`,`widgets`].includes(e.type)?`${e.type} -> ${t.type}(other ${e.type.slice(0,-1)})`:`${e.type} -> ${t.type}`;export{r as _,m as a,u as c,i as d,p as f,f as g,c as h,w as i,d as l,s as m,b as n,h as o,o as p,T as r,l as s,x as t,a as u,n as v};