@2digits/eslint-config 0.7.1 → 0.7.2
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var f__default = /*#__PURE__*/_interopDefault(f);
|
|
|
14
14
|
var U__default = /*#__PURE__*/_interopDefault(U);
|
|
15
15
|
var v__default = /*#__PURE__*/_interopDefault(v);
|
|
16
16
|
|
|
17
|
-
var N=localPkg.getPackageInfoSync("next")?.version,k={extends:N?["next"]:[]};var I=localPkg.getPackageInfoSync("react")?.version,a=I?{extends:["plugin:react/recommended","plugin:react-hooks/recommended"],settings:{react:{version:I}},rules:{"react/prop-types":["off"],"react/react-in-jsx-scope":["off"],"react/jsx-curly-newline":["off"],"react/jsx-newline":["error",{prevent:!1}]}}:{extends:[],settings:void 0,rules:void 0};var x={plugins:["storybook"],overrides:[{files:["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],rules:{"import/no-anonymous-default-export":"off","storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"warn","storybook/no-redundant-story-name":"warn","storybook/prefer-pascal-case":"warn","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error"}},{files:[".storybook/main.@(js|cjs|mjs|ts)"],rules:{"storybook/no-uninstalled-addons":"error"}}]};var P={directory:"isDirectory",file:"isFile"};function F(e){if(!Object.hasOwnProperty.call(P,e))throw new Error(`Invalid type specified: ${e}`)}var q=(e,t)=>t[P[e]](),V=e=>e instanceof URL?url.fileURLToPath(e):e;function w(e,{cwd:t=U__default.default.cwd(),type:r="file",allowSymlinks:m=!0}={}){F(r),t=V(t);let d=m?v__default.default.statSync:v__default.default.lstatSync;for(let i of e)try{let c=d(f__default.default.resolve(t,i),{throwIfNoEntry:!1});if(!c)continue;if(q(r,c))return i}catch{}}var A=e=>e instanceof URL?url.fileURLToPath(e):e,R=Symbol("findUpStop");function z(e,t={}){let r=f__default.default.resolve(A(t.cwd)||""),{root:m}=f__default.default.parse(r),d=t.stopAt||m,i=t.limit||Number.POSITIVE_INFINITY,c=[e].flat(),j=n=>{if(typeof e!="function")return w(c,n);let h=e(n.cwd);return typeof h=="string"?w([h],n):h},y=[];for(;;){let n=j({...t,cwd:r});if(n===R||(n&&y.push(f__default.default.resolve(r,n)),r===d||y.length>=i))break;r=f__default.default.dirname(r);}return y}function u(e,t={}){return z(e,{...t,limit:1})[0]}var Y=u(["tailwind.config.ts","tailwind.config.js"]),l={extends:["plugin:tailwindcss/recommended"],settings:{tailwindcss:{callees:constants.tailwindFunctions,config:Y}},rules:{"tailwindcss/classnames-order":["off"]}};var S=u(["pnpm-workspace.yaml","pnpm-lock.yaml"]),D=S&&pathe.dirname(S),s={parserOptions:{project:["./tsconfig.json","./packages/*/tsconfig.json","./apps/*/tsconfig.json"],tsconfigRootDir:D},extends:["plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking","plugin:@typescript-eslint/strict"],parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/consistent-type-exports":["error"],"@typescript-eslint/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"@typescript-eslint/no-empty-interface":["error",{allowSingleExtends:!0}],"@typescript-eslint/no-explicit-any":["warn"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-misused-promises":"off"}};var b={extends:["plugin:unicorn/recommended"],rules:{"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1}]}};var Bt={root:!0,parserOptions:{sourceType:"module",cacheLifetime:{glob:"Infinity"},...s.parserOptions},plugins:[...x.plugins],extends:["eslint:recommended","turbo",...k.extends,...l.extends,...b.extends,...s.extends,"plugin:@2digits/recommended",...a.extends,"prettier"],parser:s.parser,env:{es6:!0,node:!0},ignorePatterns:["node_modules","dist","build","coverage","public","tmp","tmp-build","!.prettierrc.js","templates"],settings:{...a.settings,...l.settings},rules:{...s.rules,...a.rules,...b.rules,...l.rules,"sort-imports":["off"],"max-params":["warn"]},overrides:[...x.overrides]};
|
|
17
|
+
var N=localPkg.getPackageInfoSync("next")?.version,k={extends:N?["next"]:[],rules:{"@next/next/no-html-link-for-pages":"off"}};var I=localPkg.getPackageInfoSync("react")?.version,a=I?{extends:["plugin:react/recommended","plugin:react-hooks/recommended"],settings:{react:{version:I}},rules:{"react/prop-types":["off"],"react/react-in-jsx-scope":["off"],"react/jsx-curly-newline":["off"],"react/jsx-newline":["error",{prevent:!1}]}}:{extends:[],settings:void 0,rules:void 0};var x={plugins:["storybook"],overrides:[{files:["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],rules:{"import/no-anonymous-default-export":"off","storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"warn","storybook/no-redundant-story-name":"warn","storybook/prefer-pascal-case":"warn","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error"}},{files:[".storybook/main.@(js|cjs|mjs|ts)"],rules:{"storybook/no-uninstalled-addons":"error"}}]};var P={directory:"isDirectory",file:"isFile"};function F(e){if(!Object.hasOwnProperty.call(P,e))throw new Error(`Invalid type specified: ${e}`)}var q=(e,t)=>t[P[e]](),V=e=>e instanceof URL?url.fileURLToPath(e):e;function w(e,{cwd:t=U__default.default.cwd(),type:r="file",allowSymlinks:m=!0}={}){F(r),t=V(t);let d=m?v__default.default.statSync:v__default.default.lstatSync;for(let i of e)try{let c=d(f__default.default.resolve(t,i),{throwIfNoEntry:!1});if(!c)continue;if(q(r,c))return i}catch{}}var A=e=>e instanceof URL?url.fileURLToPath(e):e,R=Symbol("findUpStop");function z(e,t={}){let r=f__default.default.resolve(A(t.cwd)||""),{root:m}=f__default.default.parse(r),d=t.stopAt||m,i=t.limit||Number.POSITIVE_INFINITY,c=[e].flat(),j=n=>{if(typeof e!="function")return w(c,n);let h=e(n.cwd);return typeof h=="string"?w([h],n):h},y=[];for(;;){let n=j({...t,cwd:r});if(n===R||(n&&y.push(f__default.default.resolve(r,n)),r===d||y.length>=i))break;r=f__default.default.dirname(r);}return y}function u(e,t={}){return z(e,{...t,limit:1})[0]}var Y=u(["tailwind.config.ts","tailwind.config.js"]),l={extends:["plugin:tailwindcss/recommended"],settings:{tailwindcss:{callees:constants.tailwindFunctions,config:Y}},rules:{"tailwindcss/classnames-order":["off"]}};var S=u(["pnpm-workspace.yaml","pnpm-lock.yaml"]),D=S&&pathe.dirname(S),s={parserOptions:{project:["./tsconfig.json","./packages/*/tsconfig.json","./apps/*/tsconfig.json"],tsconfigRootDir:D},extends:["plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking","plugin:@typescript-eslint/strict"],parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/consistent-type-exports":["error"],"@typescript-eslint/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"@typescript-eslint/no-empty-interface":["error",{allowSingleExtends:!0}],"@typescript-eslint/no-explicit-any":["warn"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-misused-promises":"off"}};var b={extends:["plugin:unicorn/recommended"],rules:{"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1}]}};var Bt={root:!0,parserOptions:{sourceType:"module",cacheLifetime:{glob:"Infinity"},...s.parserOptions},plugins:[...x.plugins],extends:["eslint:recommended","turbo",...k.extends,...l.extends,...b.extends,...s.extends,"plugin:@2digits/recommended",...a.extends,"prettier"],parser:s.parser,env:{es6:!0,node:!0},ignorePatterns:["node_modules","dist","build","coverage","public","tmp","tmp-build","!.prettierrc.js","templates"],settings:{...a.settings,...l.settings},rules:{...s.rules,...a.rules,...b.rules,...l.rules,"sort-imports":["off"],"max-params":["warn"]},overrides:[...x.overrides]};
|
|
18
18
|
|
|
19
19
|
module.exports = Bt;
|
|
20
20
|
//# sourceMappingURL=out.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rules/next.ts","../src/rules/react.ts","../src/rules/storybook.ts","../../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/rules/tailwind.ts","../src/rules/typescript.ts","../src/rules/unicorn.ts","../src/index.ts"],"names":["getPackageInfoSync","nextVersion","next","reactVersion","react","storybook","path","fileURLToPath","process","fs","fsPromises","Node","value","Queue","#head","#tail","#size","node","current","typeMappings","checkType","type","matchType","stat","toPath","urlOrPath","locatePathSync","paths","cwd","allowSymlinks","statFunction","path_","findUpStop","findUpMultipleSync","name","options","directory","root","stopAt","limit","runMatcher","locateOptions","foundPath","matches","findUpSync","tailwindFunctions","tailwindConfig","tailwind","dirname","workspaceRoot","tsconfigRootDir","typescript","unicorn","src_default"],"mappings":"AAAA,OAAS,sBAAAA,MAA0B,YAInC,IAAMC,EAAcD,EAAmB,MAAM,GAAG,QAEnCE,EAAoB,CAC/B,QAASD,EAAc,CAAC,MAAM,EAAI,CAAC,CACrC,ECRA,OAAS,sBAAAD,MAA0B,YAInC,IAAMG,EAAeH,EAAmB,OAAO,GAAG,QAErCI,EAAQD,EACJ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AO,CACL,oCAAqC,CAAC,QAAS,CAAE,YAAa,wBAAyB,CAAC,EACxF,6CAA8C,CAAC,OAAO,EACtD,6CAA8C,CAC5C,QACA,CACE,OAAQ,eACR,wBAAyB,GACzB,SAAU,qBACZ,CACF,EACA,wCAAyC,CAAC,QAAS,CAAE,mBAAoB,EAAK,CAAC,EAC/E,qCAAsC,CAAC,MAAM,EAC7C,iDAAkD,CAAC,OAAO,EAC1D,yCAA0C,KAC5C,CACF,EClCO,IAAME,EAAuB,CAClC,QAAS,CAAC,4BAA4B,EACtC,MAAO,CACL,wBAAyB,CAAC,KAAK,EAC/B,wBAAyB,CAAC,KAAK,EAC/B,gCAAiC,CAAC,KAAK,EACvC,yBAA0B,CAAC,QAAS,kBAAkB,EACtD,+BAAgC,CAAC,QAAS,CAAE,eAAgB,EAAM,CAAC,CACrE,CACF,ECHA,IAAOC,GAAqB,CAC1B,KAAM,GACN,cAAe,CACb,WAAY,SACZ,cAAe,CACb,KAAM,UACR,EAEA,GAAGF,EAAW,aAChB,EACA,QAAS,CAAC,GAAG9C,EAAU,OAAO,EAC9B,QAAS,CACP,qBACA,QAEA,GAAGH,EAAK,QAER,GAAG6C,EAAS,QAEZ,GAAGK,EAAQ,QAEX,GAAGD,EAAW,QAEd,8BAEA,GAAG/C,EAAM,QAET,UACF,EACA,OAAQ+C,EAAW,OACnB,IAAK,CACH,IAAK,GACL,KAAM,EACR,EACA,eAAgB,CACd,eACA,OACA,QACA,WACA,SACA,MACA,YACA,kBACA,WACF,EACA,SAAU,CACR,GAAG/C,EAAM,SAET,GAAG2C,EAAS,QACd,EACA,MAAO,CACL,GAAGI,EAAW,MAEd,GAAG/C,EAAM,MAET,GAAGgD,EAAQ,MAEX,GAAGL,EAAS,MAEZ,eAAgB,CAAC,KAAK,EACtB,aAAc,CAAC,MAAM,CACvB,EACA,UAAW,CAAC,GAAG1C,EAAU,SAAS,CACpC","sourcesContent":["import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst nextVersion = getPackageInfoSync('next')?.version;\n\nexport const next = defineConfig({\n extends: nextVersion ? ['next'] : [],\n});\n","import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst reactVersion = getPackageInfoSync('react')?.version;\n\nexport const react = reactVersion\n ? defineConfig({\n extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],\n settings: {\n react: {\n version: reactVersion,\n },\n },\n rules: {\n 'react/prop-types': ['off'],\n 'react/react-in-jsx-scope': ['off'],\n 'react/jsx-curly-newline': ['off'],\n 'react/jsx-newline': [\n 'error',\n {\n prevent: false,\n },\n ],\n },\n })\n : defineConfig({\n extends: [],\n settings: undefined,\n rules: undefined,\n });\n","import { defineConfig } from '../utils';\n\nexport const storybook = defineConfig({\n plugins: ['storybook'],\n overrides: [\n {\n files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],\n rules: {\n 'import/no-anonymous-default-export': 'off',\n 'storybook/await-interactions': 'error',\n 'storybook/context-in-play-function': 'error',\n 'storybook/default-exports': 'error',\n 'storybook/hierarchy-separator': 'warn',\n 'storybook/no-redundant-story-name': 'warn',\n 'storybook/prefer-pascal-case': 'warn',\n 'storybook/story-exports': 'error',\n 'storybook/use-storybook-expect': 'error',\n 'storybook/use-storybook-testing-library': 'error',\n },\n },\n {\n files: ['.storybook/main.@(js|cjs|mjs|ts)'],\n rules: {\n 'storybook/no-uninstalled-addons': 'error',\n },\n },\n ],\n});\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {locatePath, locatePathSync} from 'locate-path';\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, options.stopAt || root);\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = options.stopAt || root;\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { findUpSync } from 'find-up';\n\nimport { tailwindFunctions } from '@2digits/constants';\n\nimport { defineConfig } from '../utils';\n\nconst tailwindConfig = findUpSync(['tailwind.config.ts', 'tailwind.config.js']);\n\nexport const tailwind = defineConfig({\n extends: ['plugin:tailwindcss/recommended'],\n settings: {\n tailwindcss: {\n callees: tailwindFunctions,\n config: tailwindConfig,\n },\n },\n rules: {\n 'tailwindcss/classnames-order': ['off'],\n },\n});\n","import { findUpSync } from 'find-up';\nimport { dirname } from 'pathe';\n\nimport { defineConfig } from '../utils';\n\nconst workspaceRoot = findUpSync(['pnpm-workspace.yaml', 'pnpm-lock.yaml']);\n\nconst tsconfigRootDir = workspaceRoot && dirname(workspaceRoot);\n\nexport const typescript = defineConfig({\n parserOptions: {\n project: ['./tsconfig.json', './packages/*/tsconfig.json', './apps/*/tsconfig.json'],\n tsconfigRootDir,\n },\n extends: [\n 'plugin:@typescript-eslint/recommended',\n 'plugin:@typescript-eslint/recommended-requiring-type-checking',\n 'plugin:@typescript-eslint/strict',\n ],\n parser: '@typescript-eslint/parser',\n rules: {\n '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],\n '@typescript-eslint/consistent-type-exports': ['error'],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n disallowTypeAnnotations: false,\n fixStyle: 'inline-type-imports',\n },\n ],\n '@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],\n '@typescript-eslint/no-explicit-any': ['warn'],\n '@typescript-eslint/no-import-type-side-effects': ['error'],\n '@typescript-eslint/no-misused-promises': 'off',\n },\n});\n","import { defineConfig } from '../utils';\n\nexport const unicorn = defineConfig({\n extends: ['plugin:unicorn/recommended'],\n rules: {\n 'unicorn/filename-case': ['off'],\n 'unicorn/prefer-module': ['off'],\n 'unicorn/prevent-abbreviations': ['off'],\n 'unicorn/prefer-ternary': ['error', 'only-single-line'],\n 'unicorn/no-useless-undefined': ['error', { checkArguments: false }],\n },\n});\n","import { next } from './rules/next';\nimport { react } from './rules/react';\nimport { storybook } from './rules/storybook';\nimport { tailwind } from './rules/tailwind';\nimport { typescript } from './rules/typescript';\nimport { unicorn } from './rules/unicorn';\nimport { defineConfig } from './utils';\n\nexport default defineConfig({\n root: true,\n parserOptions: {\n sourceType: 'module',\n cacheLifetime: {\n glob: 'Infinity',\n },\n\n ...typescript.parserOptions,\n },\n plugins: [...storybook.plugins],\n extends: [\n 'eslint:recommended',\n 'turbo',\n\n ...next.extends,\n\n ...tailwind.extends,\n\n ...unicorn.extends,\n\n ...typescript.extends,\n\n 'plugin:@2digits/recommended',\n\n ...react.extends,\n\n 'prettier',\n ],\n parser: typescript.parser,\n env: {\n es6: true,\n node: true,\n },\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n 'public',\n 'tmp',\n 'tmp-build',\n '!.prettierrc.js',\n 'templates',\n ],\n settings: {\n ...react.settings,\n\n ...tailwind.settings,\n },\n rules: {\n ...typescript.rules,\n\n ...react.rules,\n\n ...unicorn.rules,\n\n ...tailwind.rules,\n\n 'sort-imports': ['off'],\n 'max-params': ['warn'],\n },\n overrides: [...storybook.overrides],\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/rules/next.ts","../src/rules/react.ts","../src/rules/storybook.ts","../../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/rules/tailwind.ts","../src/rules/typescript.ts","../src/rules/unicorn.ts","../src/index.ts"],"names":["getPackageInfoSync","nextVersion","next","reactVersion","react","storybook","path","fileURLToPath","process","fs","fsPromises","Node","value","Queue","#head","#tail","#size","node","current","typeMappings","checkType","type","matchType","stat","toPath","urlOrPath","locatePathSync","paths","cwd","allowSymlinks","statFunction","path_","findUpStop","findUpMultipleSync","name","options","directory","root","stopAt","limit","runMatcher","locateOptions","foundPath","matches","findUpSync","tailwindFunctions","tailwindConfig","tailwind","dirname","workspaceRoot","tsconfigRootDir","typescript","unicorn","src_default"],"mappings":"AAAA,OAAS,sBAAAA,MAA0B,YAInC,IAAMC,EAAcD,EAAmB,MAAM,GAAG,QAEnCE,EAAoB,CAC/B,QAASD,EAAc,CAAC,MAAM,EAAI,CAAC,EACnC,MAAO,CACL,oCAAqC,KACvC,CACF,ECXA,OAAS,sBAAAD,MAA0B,YAInC,IAAMG,EAAeH,EAAmB,OAAO,GAAG,QAErCI,EAAQD,EACJ,CACX,QAAS,CAAC,2BAA4B,gCAAgC,EACtE,SAAU,CACR,MAAO,CACL,QAASA,CACX,CACF,EACA,MAAO,CACL,mBAAoB,CAAC,KAAK,EAC1B,2BAA4B,CAAC,KAAK,EAClC,0BAA2B,CAAC,KAAK,EACjC,oBAAqB,CACnB,QACA,CACE,QAAS,EACX,CACF,CACF,CACF,EACa,CACX,QAAS,CAAC,EACV,SAAU,OACV,MAAO,MACT,EC5BG,IAAME,EAAyB,CACpC,QAAS,CAAC,WAAW,EACrB,UAAW,CACT,CACE,MAAO,CAAC,oCAAoC,EAC5C,MAAO,CACL,qCAAsC,MACtC,+BAAgC,QAChC,qCAAsC,QACtC,4BAA6B,QAC7B,gCAAiC,OACjC,oCAAqC,OACrC,+BAAgC,OAChC,0BAA2B,QAC3B,iCAAkC,QAClC,0CAA2C,OAC7C,CACF,EACA,CACE,MAAO,CAAC,kCAAkC,EAC1C,MAAO,CACL,kCAAmC,OACrC,CACF,CACF,CACF,EC3BA,OAAOC,MAAU,OACjB,OAAQ,iBAAAC,MAAoB,MCD5B,OAAOC,MAAa,UACpB,OAAOF,MAAU,OACjB,OAAOG,GAAK,YAAYC,OAAiB,KACzC,OAAQ,iBAAAH,MAAoB,MCE5B,IAAMI,EAAN,KAAW,CACV,MACA,KAEA,YAAYC,EAAO,CAClB,KAAK,MAAQA,CACd,CACD,EAEq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CACH,IAAK,GACL,KAAM,EACR,EACA,eAAgB,CACd,eACA,OACA,QACA,WACA,SACA,MACA,YACA,kBACA,WACF,EACA,SAAU,CACR,GAAG/C,EAAM,SAET,GAAG2C,EAAS,QACd,EACA,MAAO,CACL,GAAGI,EAAW,MAEd,GAAG/C,EAAM,MAET,GAAGgD,EAAQ,MAEX,GAAGL,EAAS,MAEZ,eAAgB,CAAC,KAAK,EACtB,aAAc,CAAC,MAAM,CACvB,EACA,UAAW,CAAC,GAAG1C,EAAU,SAAS,CACpC","sourcesContent":["import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst nextVersion = getPackageInfoSync('next')?.version;\n\nexport const next = defineConfig({\n extends: nextVersion ? ['next'] : [],\n rules: {\n '@next/next/no-html-link-for-pages': 'off',\n },\n});\n","import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst reactVersion = getPackageInfoSync('react')?.version;\n\nexport const react = reactVersion\n ? defineConfig({\n extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],\n settings: {\n react: {\n version: reactVersion,\n },\n },\n rules: {\n 'react/prop-types': ['off'],\n 'react/react-in-jsx-scope': ['off'],\n 'react/jsx-curly-newline': ['off'],\n 'react/jsx-newline': [\n 'error',\n {\n prevent: false,\n },\n ],\n },\n })\n : defineConfig({\n extends: [],\n settings: undefined,\n rules: undefined,\n });\n","import { defineConfig } from '../utils';\n\nexport const storybook = defineConfig({\n plugins: ['storybook'],\n overrides: [\n {\n files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],\n rules: {\n 'import/no-anonymous-default-export': 'off',\n 'storybook/await-interactions': 'error',\n 'storybook/context-in-play-function': 'error',\n 'storybook/default-exports': 'error',\n 'storybook/hierarchy-separator': 'warn',\n 'storybook/no-redundant-story-name': 'warn',\n 'storybook/prefer-pascal-case': 'warn',\n 'storybook/story-exports': 'error',\n 'storybook/use-storybook-expect': 'error',\n 'storybook/use-storybook-testing-library': 'error',\n },\n },\n {\n files: ['.storybook/main.@(js|cjs|mjs|ts)'],\n rules: {\n 'storybook/no-uninstalled-addons': 'error',\n },\n },\n ],\n});\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {locatePath, locatePathSync} from 'locate-path';\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, options.stopAt || root);\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = options.stopAt || root;\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { findUpSync } from 'find-up';\n\nimport { tailwindFunctions } from '@2digits/constants';\n\nimport { defineConfig } from '../utils';\n\nconst tailwindConfig = findUpSync(['tailwind.config.ts', 'tailwind.config.js']);\n\nexport const tailwind = defineConfig({\n extends: ['plugin:tailwindcss/recommended'],\n settings: {\n tailwindcss: {\n callees: tailwindFunctions,\n config: tailwindConfig,\n },\n },\n rules: {\n 'tailwindcss/classnames-order': ['off'],\n },\n});\n","import { findUpSync } from 'find-up';\nimport { dirname } from 'pathe';\n\nimport { defineConfig } from '../utils';\n\nconst workspaceRoot = findUpSync(['pnpm-workspace.yaml', 'pnpm-lock.yaml']);\n\nconst tsconfigRootDir = workspaceRoot && dirname(workspaceRoot);\n\nexport const typescript = defineConfig({\n parserOptions: {\n project: ['./tsconfig.json', './packages/*/tsconfig.json', './apps/*/tsconfig.json'],\n tsconfigRootDir,\n },\n extends: [\n 'plugin:@typescript-eslint/recommended',\n 'plugin:@typescript-eslint/recommended-requiring-type-checking',\n 'plugin:@typescript-eslint/strict',\n ],\n parser: '@typescript-eslint/parser',\n rules: {\n '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],\n '@typescript-eslint/consistent-type-exports': ['error'],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n disallowTypeAnnotations: false,\n fixStyle: 'inline-type-imports',\n },\n ],\n '@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],\n '@typescript-eslint/no-explicit-any': ['warn'],\n '@typescript-eslint/no-import-type-side-effects': ['error'],\n '@typescript-eslint/no-misused-promises': 'off',\n },\n});\n","import { defineConfig } from '../utils';\n\nexport const unicorn = defineConfig({\n extends: ['plugin:unicorn/recommended'],\n rules: {\n 'unicorn/filename-case': ['off'],\n 'unicorn/prefer-module': ['off'],\n 'unicorn/prevent-abbreviations': ['off'],\n 'unicorn/prefer-ternary': ['error', 'only-single-line'],\n 'unicorn/no-useless-undefined': ['error', { checkArguments: false }],\n },\n});\n","import { next } from './rules/next';\nimport { react } from './rules/react';\nimport { storybook } from './rules/storybook';\nimport { tailwind } from './rules/tailwind';\nimport { typescript } from './rules/typescript';\nimport { unicorn } from './rules/unicorn';\nimport { defineConfig } from './utils';\n\nexport default defineConfig({\n root: true,\n parserOptions: {\n sourceType: 'module',\n cacheLifetime: {\n glob: 'Infinity',\n },\n\n ...typescript.parserOptions,\n },\n plugins: [...storybook.plugins],\n extends: [\n 'eslint:recommended',\n 'turbo',\n\n ...next.extends,\n\n ...tailwind.extends,\n\n ...unicorn.extends,\n\n ...typescript.extends,\n\n 'plugin:@2digits/recommended',\n\n ...react.extends,\n\n 'prettier',\n ],\n parser: typescript.parser,\n env: {\n es6: true,\n node: true,\n },\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n 'public',\n 'tmp',\n 'tmp-build',\n '!.prettierrc.js',\n 'templates',\n ],\n settings: {\n ...react.settings,\n\n ...tailwind.settings,\n },\n rules: {\n ...typescript.rules,\n\n ...react.rules,\n\n ...unicorn.rules,\n\n ...tailwind.rules,\n\n 'sort-imports': ['off'],\n 'max-params': ['warn'],\n },\n overrides: [...storybook.overrides],\n});\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import P from 'node:fs';
|
|
|
6
6
|
import { tailwindFunctions } from '@2digits/constants';
|
|
7
7
|
import { dirname } from 'pathe';
|
|
8
8
|
|
|
9
|
-
var E=getPackageInfoSync("next")?.version,I={extends:E?["next"]:[]};var v=getPackageInfoSync("react")?.version,p=v?{extends:["plugin:react/recommended","plugin:react-hooks/recommended"],settings:{react:{version:v}},rules:{"react/prop-types":["off"],"react/react-in-jsx-scope":["off"],"react/jsx-curly-newline":["off"],"react/jsx-newline":["error",{prevent:!1}]}}:{extends:[],settings:void 0,rules:void 0};var g={plugins:["storybook"],overrides:[{files:["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],rules:{"import/no-anonymous-default-export":"off","storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"warn","storybook/no-redundant-story-name":"warn","storybook/prefer-pascal-case":"warn","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error"}},{files:[".storybook/main.@(js|cjs|mjs|ts)"],rules:{"storybook/no-uninstalled-addons":"error"}}]};var S={directory:"isDirectory",file:"isFile"};function q(e){if(!Object.hasOwnProperty.call(S,e))throw new Error(`Invalid type specified: ${e}`)}var V=(e,t)=>t[S[e]](),_=e=>e instanceof URL?fileURLToPath(e):e;function b(e,{cwd:t=C.cwd(),type:r="file",allowSymlinks:d=!0}={}){q(r),t=_(t);let y=d?P.statSync:P.lstatSync;for(let c of e)try{let a=y(u.resolve(t,c),{throwIfNoEntry:!1});if(!a)continue;if(V(r,a))return c}catch{}}var R=e=>e instanceof URL?fileURLToPath(e):e,z=Symbol("findUpStop");function M(e,t={}){let r=u.resolve(R(t.cwd)||""),{root:d}=u.parse(r),y=t.stopAt||d,c=t.limit||Number.POSITIVE_INFINITY,a=[e].flat(),T=s=>{if(typeof e!="function")return b(a,s);let x=e(s.cwd);return typeof x=="string"?b([x],s):x},h=[];for(;;){let s=T({...t,cwd:r});if(s===z||(s&&h.push(u.resolve(r,s)),r===y||h.length>=c))break;r=u.dirname(r);}return h}function l(e,t={}){return M(e,{...t,limit:1})[0]}var O=l(["tailwind.config.ts","tailwind.config.js"]),m={extends:["plugin:tailwindcss/recommended"],settings:{tailwindcss:{callees:tailwindFunctions,config:O}},rules:{"tailwindcss/classnames-order":["off"]}};var j=l(["pnpm-workspace.yaml","pnpm-lock.yaml"]),Q=j&&dirname(j),i={parserOptions:{project:["./tsconfig.json","./packages/*/tsconfig.json","./apps/*/tsconfig.json"],tsconfigRootDir:Q},extends:["plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking","plugin:@typescript-eslint/strict"],parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/consistent-type-exports":["error"],"@typescript-eslint/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"@typescript-eslint/no-empty-interface":["error",{allowSingleExtends:!0}],"@typescript-eslint/no-explicit-any":["warn"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-misused-promises":"off"}};var k={extends:["plugin:unicorn/recommended"],rules:{"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1}]}};var Qt={root:!0,parserOptions:{sourceType:"module",cacheLifetime:{glob:"Infinity"},...i.parserOptions},plugins:[...g.plugins],extends:["eslint:recommended","turbo",...I.extends,...m.extends,...k.extends,...i.extends,"plugin:@2digits/recommended",...p.extends,"prettier"],parser:i.parser,env:{es6:!0,node:!0},ignorePatterns:["node_modules","dist","build","coverage","public","tmp","tmp-build","!.prettierrc.js","templates"],settings:{...p.settings,...m.settings},rules:{...i.rules,...p.rules,...k.rules,...m.rules,"sort-imports":["off"],"max-params":["warn"]},overrides:[...g.overrides]};
|
|
9
|
+
var E=getPackageInfoSync("next")?.version,I={extends:E?["next"]:[],rules:{"@next/next/no-html-link-for-pages":"off"}};var v=getPackageInfoSync("react")?.version,p=v?{extends:["plugin:react/recommended","plugin:react-hooks/recommended"],settings:{react:{version:v}},rules:{"react/prop-types":["off"],"react/react-in-jsx-scope":["off"],"react/jsx-curly-newline":["off"],"react/jsx-newline":["error",{prevent:!1}]}}:{extends:[],settings:void 0,rules:void 0};var g={plugins:["storybook"],overrides:[{files:["*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],rules:{"import/no-anonymous-default-export":"off","storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"warn","storybook/no-redundant-story-name":"warn","storybook/prefer-pascal-case":"warn","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error"}},{files:[".storybook/main.@(js|cjs|mjs|ts)"],rules:{"storybook/no-uninstalled-addons":"error"}}]};var S={directory:"isDirectory",file:"isFile"};function q(e){if(!Object.hasOwnProperty.call(S,e))throw new Error(`Invalid type specified: ${e}`)}var V=(e,t)=>t[S[e]](),_=e=>e instanceof URL?fileURLToPath(e):e;function b(e,{cwd:t=C.cwd(),type:r="file",allowSymlinks:d=!0}={}){q(r),t=_(t);let y=d?P.statSync:P.lstatSync;for(let c of e)try{let a=y(u.resolve(t,c),{throwIfNoEntry:!1});if(!a)continue;if(V(r,a))return c}catch{}}var R=e=>e instanceof URL?fileURLToPath(e):e,z=Symbol("findUpStop");function M(e,t={}){let r=u.resolve(R(t.cwd)||""),{root:d}=u.parse(r),y=t.stopAt||d,c=t.limit||Number.POSITIVE_INFINITY,a=[e].flat(),T=s=>{if(typeof e!="function")return b(a,s);let x=e(s.cwd);return typeof x=="string"?b([x],s):x},h=[];for(;;){let s=T({...t,cwd:r});if(s===z||(s&&h.push(u.resolve(r,s)),r===y||h.length>=c))break;r=u.dirname(r);}return h}function l(e,t={}){return M(e,{...t,limit:1})[0]}var O=l(["tailwind.config.ts","tailwind.config.js"]),m={extends:["plugin:tailwindcss/recommended"],settings:{tailwindcss:{callees:tailwindFunctions,config:O}},rules:{"tailwindcss/classnames-order":["off"]}};var j=l(["pnpm-workspace.yaml","pnpm-lock.yaml"]),Q=j&&dirname(j),i={parserOptions:{project:["./tsconfig.json","./packages/*/tsconfig.json","./apps/*/tsconfig.json"],tsconfigRootDir:Q},extends:["plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking","plugin:@typescript-eslint/strict"],parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/consistent-type-exports":["error"],"@typescript-eslint/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:!1,fixStyle:"inline-type-imports"}],"@typescript-eslint/no-empty-interface":["error",{allowSingleExtends:!0}],"@typescript-eslint/no-explicit-any":["warn"],"@typescript-eslint/no-import-type-side-effects":["error"],"@typescript-eslint/no-misused-promises":"off"}};var k={extends:["plugin:unicorn/recommended"],rules:{"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:!1}]}};var Qt={root:!0,parserOptions:{sourceType:"module",cacheLifetime:{glob:"Infinity"},...i.parserOptions},plugins:[...g.plugins],extends:["eslint:recommended","turbo",...I.extends,...m.extends,...k.extends,...i.extends,"plugin:@2digits/recommended",...p.extends,"prettier"],parser:i.parser,env:{es6:!0,node:!0},ignorePatterns:["node_modules","dist","build","coverage","public","tmp","tmp-build","!.prettierrc.js","templates"],settings:{...p.settings,...m.settings},rules:{...i.rules,...p.rules,...k.rules,...m.rules,"sort-imports":["off"],"max-params":["warn"]},overrides:[...g.overrides]};
|
|
10
10
|
|
|
11
11
|
export { Qt as default };
|
|
12
12
|
//# sourceMappingURL=out.js.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rules/next.ts","../src/rules/react.ts","../src/rules/storybook.ts","../../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../src/rules/tailwind.ts","../src/rules/typescript.ts","../src/rules/unicorn.ts","../src/index.ts"],"names":["getPackageInfoSync","nextVersion","next","reactVersion","react","storybook","path","fileURLToPath","process","fs","fsPromises","Node","value","Queue","#head","#tail","#size","node","current","typeMappings","checkType","type","matchType","stat","toPath","urlOrPath","locatePathSync","paths","cwd","allowSymlinks","statFunction","path_","findUpStop","findUpMultipleSync","name","options","directory","root","stopAt","limit","runMatcher","locateOptions","foundPath","matches","findUpSync","tailwindFunctions","tailwindConfig","tailwind","dirname","workspaceRoot","tsconfigRootDir","typescript","unicorn","src_default"],"mappings":"AAAA,OAAS,sBAAAA,MAA0B,YAInC,IAAMC,EAAcD,EAAmB,MAAM,GAAG,QAEnCE,EAAoB,CAC/B,QAASD,EAAc,CAAC,MAAM,EAAI,CAAC,CACrC,ECRA,OAAS,sBAAAD,MAA0B,YAInC,IAAMG,EAAeH,EAAmB,OAAO,GAAG,QAErCI,EAAQD,EACJ,CACX,QAAS,CAAC,2BAA4B,gCAAgC,EACtE,SAAU,CACR,MAAO,CACL,QAASA,CACX,CACF,EACA,MAAO,CACL,mBAAoB,CAAC,KAAK,EAC1B,2BAA4B,CAAC,KAAK,EAClC,0BAA2B,CAAC,KAAK,EACjC,oBAAqB,CACnB,QACA,CACE,QAAS,EACX,CACF,CACF,CACF,EACa,CACX,QAAS,CAAC,EACV,SAAU,OACV,MAAO,MACT,EC5BG,IAAME,EAAyB,CACpC,QAAS,CAAC,WAAW,EACrB,UAAW,CACT,CACE,MAAO,CAAC,oCAAoC,EAC5C,MAAO,CACL,qCAAsC,MACtC,+BAAgC,QAChC,qCAAsC,QACtC,4BAA6B,QAC7B,gCAAiC,OACjC,oCAAqC,OACrC,+BAAgC,OAChC,0BAA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rE,CACF,ECHA,IAAOC,GAAqB,CAC1B,KAAM,GACN,cAAe,CACb,WAAY,SACZ,cAAe,CACb,KAAM,UACR,EAEA,GAAGF,EAAW,aAChB,EACA,QAAS,CAAC,GAAG9C,EAAU,OAAO,EAC9B,QAAS,CACP,qBACA,QAEA,GAAGH,EAAK,QAER,GAAG6C,EAAS,QAEZ,GAAGK,EAAQ,QAEX,GAAGD,EAAW,QAEd,8BAEA,GAAG/C,EAAM,QAET,UACF,EACA,OAAQ+C,EAAW,OACnB,IAAK,CACH,IAAK,GACL,KAAM,EACR,EACA,eAAgB,CACd,eACA,OACA,QACA,WACA,SACA,MACA,YACA,kBACA,WACF,EACA,SAAU,CACR,GAAG/C,EAAM,SAET,GAAG2C,EAAS,QACd,EACA,MAAO,CACL,GAAGI,EAAW,MAEd,GAAG/C,EAAM,MAET,GAAGgD,EAAQ,MAEX,GAAGL,EAAS,MAEZ,eAAgB,CAAC,KAAK,EACtB,aAAc,CAAC,MAAM,CACvB,EACA,UAAW,CAAC,GAAG1C,EAAU,SAAS,CACpC","sourcesContent":["import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst nextVersion = getPackageInfoSync('next')?.version;\n\nexport const next = defineConfig({\n extends: nextVersion ? ['next'] : [],\n});\n","import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst reactVersion = getPackageInfoSync('react')?.version;\n\nexport const react = reactVersion\n ? defineConfig({\n extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],\n settings: {\n react: {\n version: reactVersion,\n },\n },\n rules: {\n 'react/prop-types': ['off'],\n 'react/react-in-jsx-scope': ['off'],\n 'react/jsx-curly-newline': ['off'],\n 'react/jsx-newline': [\n 'error',\n {\n prevent: false,\n },\n ],\n },\n })\n : defineConfig({\n extends: [],\n settings: undefined,\n rules: undefined,\n });\n","import { defineConfig } from '../utils';\n\nexport const storybook = defineConfig({\n plugins: ['storybook'],\n overrides: [\n {\n files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],\n rules: {\n 'import/no-anonymous-default-export': 'off',\n 'storybook/await-interactions': 'error',\n 'storybook/context-in-play-function': 'error',\n 'storybook/default-exports': 'error',\n 'storybook/hierarchy-separator': 'warn',\n 'storybook/no-redundant-story-name': 'warn',\n 'storybook/prefer-pascal-case': 'warn',\n 'storybook/story-exports': 'error',\n 'storybook/use-storybook-expect': 'error',\n 'storybook/use-storybook-testing-library': 'error',\n },\n },\n {\n files: ['.storybook/main.@(js|cjs|mjs|ts)'],\n rules: {\n 'storybook/no-uninstalled-addons': 'error',\n },\n },\n ],\n});\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {locatePath, locatePathSync} from 'locate-path';\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, options.stopAt || root);\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = options.stopAt || root;\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import { findUpSync } from 'find-up';\n\nimport { tailwindFunctions } from '@2digits/constants';\n\nimport { defineConfig } from '../utils';\n\nconst tailwindConfig = findUpSync(['tailwind.config.ts', 'tailwind.config.js']);\n\nexport const tailwind = defineConfig({\n extends: ['plugin:tailwindcss/recommended'],\n settings: {\n tailwindcss: {\n callees: tailwindFunctions,\n config: tailwindConfig,\n },\n },\n rules: {\n 'tailwindcss/classnames-order': ['off'],\n },\n});\n","import { findUpSync } from 'find-up';\nimport { dirname } from 'pathe';\n\nimport { defineConfig } from '../utils';\n\nconst workspaceRoot = findUpSync(['pnpm-workspace.yaml', 'pnpm-lock.yaml']);\n\nconst tsconfigRootDir = workspaceRoot && dirname(workspaceRoot);\n\nexport const typescript = defineConfig({\n parserOptions: {\n project: ['./tsconfig.json', './packages/*/tsconfig.json', './apps/*/tsconfig.json'],\n tsconfigRootDir,\n },\n extends: [\n 'plugin:@typescript-eslint/recommended',\n 'plugin:@typescript-eslint/recommended-requiring-type-checking',\n 'plugin:@typescript-eslint/strict',\n ],\n parser: '@typescript-eslint/parser',\n rules: {\n '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],\n '@typescript-eslint/consistent-type-exports': ['error'],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n disallowTypeAnnotations: false,\n fixStyle: 'inline-type-imports',\n },\n ],\n '@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],\n '@typescript-eslint/no-explicit-any': ['warn'],\n '@typescript-eslint/no-import-type-side-effects': ['error'],\n '@typescript-eslint/no-misused-promises': 'off',\n },\n});\n","import { defineConfig } from '../utils';\n\nexport const unicorn = defineConfig({\n extends: ['plugin:unicorn/recommended'],\n rules: {\n 'unicorn/filename-case': ['off'],\n 'unicorn/prefer-module': ['off'],\n 'unicorn/prevent-abbreviations': ['off'],\n 'unicorn/prefer-ternary': ['error', 'only-single-line'],\n 'unicorn/no-useless-undefined': ['error', { checkArguments: false }],\n },\n});\n","import { next } from './rules/next';\nimport { react } from './rules/react';\nimport { storybook } from './rules/storybook';\nimport { tailwind } from './rules/tailwind';\nimport { typescript } from './rules/typescript';\nimport { unicorn } from './rules/unicorn';\nimport { defineConfig } from './utils';\n\nexport default defineConfig({\n root: true,\n parserOptions: {\n sourceType: 'module',\n cacheLifetime: {\n glob: 'Infinity',\n },\n\n ...typescript.parserOptions,\n },\n plugins: [...storybook.plugins],\n extends: [\n 'eslint:recommended',\n 'turbo',\n\n ...next.extends,\n\n ...tailwind.extends,\n\n ...unicorn.extends,\n\n ...typescript.extends,\n\n 'plugin:@2digits/recommended',\n\n ...react.extends,\n\n 'prettier',\n ],\n parser: typescript.parser,\n env: {\n es6: true,\n node: true,\n },\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n 'public',\n 'tmp',\n 'tmp-build',\n '!.prettierrc.js',\n 'templates',\n ],\n settings: {\n ...react.settings,\n\n ...tailwind.settings,\n },\n rules: {\n ...typescript.rules,\n\n ...react.rules,\n\n ...unicorn.rules,\n\n ...tailwind.rules,\n\n 'sort-imports': ['off'],\n 'max-params': ['warn'],\n },\n overrides: [...storybook.overrides],\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/rules/next.ts","../src/rules/react.ts","../src/rules/storybook.ts","../../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../src/rules/tailwind.ts","../src/rules/typescript.ts","../src/rules/unicorn.ts","../src/index.ts"],"names":["getPackageInfoSync","nextVersion","next","reactVersion","react","storybook","path","fileURLToPath","process","fs","fsPromises","Node","value","Queue","#head","#tail","#size","node","current","typeMappings","checkType","type","matchType","stat","toPath","urlOrPath","locatePathSync","paths","cwd","allowSymlinks","statFunction","path_","findUpStop","findUpMultipleSync","name","options","directory","root","stopAt","limit","runMatcher","locateOptions","foundPath","matches","findUpSync","tailwindFunctions","tailwindConfig","tailwind","dirname","workspaceRoot","tsconfigRootDir","typescript","unicorn","src_default"],"mappings":"AAAA,OAAS,sBAAAA,MAA0B,YAInC,IAAMC,EAAcD,EAAmB,MAAM,GAAG,QAEnCE,EAAoB,CAC/B,QAASD,EAAc,CAAC,MAAM,EAAI,CAAC,EACnC,MAAO,CACL,oCAAqC,KACvC,CACF,ECXA,OAAS,sBAAAD,MAA0B,YAInC,IAAMG,EAAeH,EAAmB,OAAO,GAAG,QAErCI,EAAQD,EACJ,CACX,QAAS,CAAC,2BAA4B,gCAAgC,EACtE,SAAU,CACR,MAAO,CACL,QAASA,CACX,CACF,EACA,MAAO,CACL,mBAAoB,CAAC,KAAK,EAC1B,2BAA4B,CAAC,KAAK,EAClC,0BAA2B,CAAC,KAAK,EACjC,oBAAqB,CACnB,QACA,CACE,QAAS,EACX,CACF,CACF,CACF,EACa,CACX,QAAS,CAAC,EACV,SAAU,OACV,MAAO,MACT,EC5BG,IAAME,EAAyB,CACpC,QAAS,CAAC,WAAW,EACrB,UAAW,CACT,CACE,MAAO,CAAC,oCAAoC,EAC5C,MAAO,CACL,qCAAsC,MACtC,+BAAg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vC,yBAA0B,CAAC,QAAS,kBAAkB,EACtD,+BAAgC,CAAC,QAAS,CAAE,eAAgB,EAAM,CAAC,CACrE,CACF,ECHA,IAAOC,GAAqB,CAC1B,KAAM,GACN,cAAe,CACb,WAAY,SACZ,cAAe,CACb,KAAM,UACR,EAEA,GAAGF,EAAW,aAChB,EACA,QAAS,CAAC,GAAG9C,EAAU,OAAO,EAC9B,QAAS,CACP,qBACA,QAEA,GAAGH,EAAK,QAER,GAAG6C,EAAS,QAEZ,GAAGK,EAAQ,QAEX,GAAGD,EAAW,QAEd,8BAEA,GAAG/C,EAAM,QAET,UACF,EACA,OAAQ+C,EAAW,OACnB,IAAK,CACH,IAAK,GACL,KAAM,EACR,EACA,eAAgB,CACd,eACA,OACA,QACA,WACA,SACA,MACA,YACA,kBACA,WACF,EACA,SAAU,CACR,GAAG/C,EAAM,SAET,GAAG2C,EAAS,QACd,EACA,MAAO,CACL,GAAGI,EAAW,MAEd,GAAG/C,EAAM,MAET,GAAGgD,EAAQ,MAEX,GAAGL,EAAS,MAEZ,eAAgB,CAAC,KAAK,EACtB,aAAc,CAAC,MAAM,CACvB,EACA,UAAW,CAAC,GAAG1C,EAAU,SAAS,CACpC","sourcesContent":["import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst nextVersion = getPackageInfoSync('next')?.version;\n\nexport const next = defineConfig({\n extends: nextVersion ? ['next'] : [],\n rules: {\n '@next/next/no-html-link-for-pages': 'off',\n },\n});\n","import { getPackageInfoSync } from 'local-pkg';\n\nimport { defineConfig } from '../utils';\n\nconst reactVersion = getPackageInfoSync('react')?.version;\n\nexport const react = reactVersion\n ? defineConfig({\n extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],\n settings: {\n react: {\n version: reactVersion,\n },\n },\n rules: {\n 'react/prop-types': ['off'],\n 'react/react-in-jsx-scope': ['off'],\n 'react/jsx-curly-newline': ['off'],\n 'react/jsx-newline': [\n 'error',\n {\n prevent: false,\n },\n ],\n },\n })\n : defineConfig({\n extends: [],\n settings: undefined,\n rules: undefined,\n });\n","import { defineConfig } from '../utils';\n\nexport const storybook = defineConfig({\n plugins: ['storybook'],\n overrides: [\n {\n files: ['*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],\n rules: {\n 'import/no-anonymous-default-export': 'off',\n 'storybook/await-interactions': 'error',\n 'storybook/context-in-play-function': 'error',\n 'storybook/default-exports': 'error',\n 'storybook/hierarchy-separator': 'warn',\n 'storybook/no-redundant-story-name': 'warn',\n 'storybook/prefer-pascal-case': 'warn',\n 'storybook/story-exports': 'error',\n 'storybook/use-storybook-expect': 'error',\n 'storybook/use-storybook-testing-library': 'error',\n },\n },\n {\n files: ['.storybook/main.@(js|cjs|mjs|ts)'],\n rules: {\n 'storybook/no-uninstalled-addons': 'error',\n },\n },\n ],\n});\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {locatePath, locatePathSync} from 'locate-path';\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, options.stopAt || root);\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) || '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = options.stopAt || root;\n\tconst limit = options.limit || Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import { findUpSync } from 'find-up';\n\nimport { tailwindFunctions } from '@2digits/constants';\n\nimport { defineConfig } from '../utils';\n\nconst tailwindConfig = findUpSync(['tailwind.config.ts', 'tailwind.config.js']);\n\nexport const tailwind = defineConfig({\n extends: ['plugin:tailwindcss/recommended'],\n settings: {\n tailwindcss: {\n callees: tailwindFunctions,\n config: tailwindConfig,\n },\n },\n rules: {\n 'tailwindcss/classnames-order': ['off'],\n },\n});\n","import { findUpSync } from 'find-up';\nimport { dirname } from 'pathe';\n\nimport { defineConfig } from '../utils';\n\nconst workspaceRoot = findUpSync(['pnpm-workspace.yaml', 'pnpm-lock.yaml']);\n\nconst tsconfigRootDir = workspaceRoot && dirname(workspaceRoot);\n\nexport const typescript = defineConfig({\n parserOptions: {\n project: ['./tsconfig.json', './packages/*/tsconfig.json', './apps/*/tsconfig.json'],\n tsconfigRootDir,\n },\n extends: [\n 'plugin:@typescript-eslint/recommended',\n 'plugin:@typescript-eslint/recommended-requiring-type-checking',\n 'plugin:@typescript-eslint/strict',\n ],\n parser: '@typescript-eslint/parser',\n rules: {\n '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],\n '@typescript-eslint/consistent-type-exports': ['error'],\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n disallowTypeAnnotations: false,\n fixStyle: 'inline-type-imports',\n },\n ],\n '@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],\n '@typescript-eslint/no-explicit-any': ['warn'],\n '@typescript-eslint/no-import-type-side-effects': ['error'],\n '@typescript-eslint/no-misused-promises': 'off',\n },\n});\n","import { defineConfig } from '../utils';\n\nexport const unicorn = defineConfig({\n extends: ['plugin:unicorn/recommended'],\n rules: {\n 'unicorn/filename-case': ['off'],\n 'unicorn/prefer-module': ['off'],\n 'unicorn/prevent-abbreviations': ['off'],\n 'unicorn/prefer-ternary': ['error', 'only-single-line'],\n 'unicorn/no-useless-undefined': ['error', { checkArguments: false }],\n },\n});\n","import { next } from './rules/next';\nimport { react } from './rules/react';\nimport { storybook } from './rules/storybook';\nimport { tailwind } from './rules/tailwind';\nimport { typescript } from './rules/typescript';\nimport { unicorn } from './rules/unicorn';\nimport { defineConfig } from './utils';\n\nexport default defineConfig({\n root: true,\n parserOptions: {\n sourceType: 'module',\n cacheLifetime: {\n glob: 'Infinity',\n },\n\n ...typescript.parserOptions,\n },\n plugins: [...storybook.plugins],\n extends: [\n 'eslint:recommended',\n 'turbo',\n\n ...next.extends,\n\n ...tailwind.extends,\n\n ...unicorn.extends,\n\n ...typescript.extends,\n\n 'plugin:@2digits/recommended',\n\n ...react.extends,\n\n 'prettier',\n ],\n parser: typescript.parser,\n env: {\n es6: true,\n node: true,\n },\n ignorePatterns: [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n 'public',\n 'tmp',\n 'tmp-build',\n '!.prettierrc.js',\n 'templates',\n ],\n settings: {\n ...react.settings,\n\n ...tailwind.settings,\n },\n rules: {\n ...typescript.rules,\n\n ...react.rules,\n\n ...unicorn.rules,\n\n ...tailwind.rules,\n\n 'sort-imports': ['off'],\n 'max-params': ['warn'],\n },\n overrides: [...storybook.overrides],\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2digits/eslint-config",
|
|
3
3
|
"description": "Effortlessly enforce best practices and catch errors with this comprehensive ESLint configuration for TypeScript, featuring popular plugins like @typescript-eslint, eslint-plugin-react, and eslint-plugin-unicorn.",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"public": true,
|
|
7
7
|
"sideEffects": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@typescript-eslint/parser": "^5.60.1",
|
|
40
40
|
"eslint-config-next": "^13.4.7",
|
|
41
41
|
"eslint-config-prettier": "^8.8.0",
|
|
42
|
-
"eslint-config-turbo": "^1.10.
|
|
42
|
+
"eslint-config-turbo": "^1.10.7",
|
|
43
43
|
"eslint-plugin-react": "^7.32.2",
|
|
44
44
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
45
45
|
"eslint-plugin-storybook": "^0.6.12",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@2digits/tsconfig": "*",
|
|
54
|
-
"eslint": ">=8.
|
|
54
|
+
"eslint": ">=8.44.0",
|
|
55
55
|
"eslint-define-config": "^1.21.0",
|
|
56
56
|
"tsup": "^7.1.0",
|
|
57
|
-
"turbo": "^1.10.
|
|
58
|
-
"typescript": "^5.1.
|
|
57
|
+
"turbo": "^1.10.7",
|
|
58
|
+
"typescript": "^5.1.6"
|
|
59
59
|
},
|
|
60
60
|
"eslintConfig": {
|
|
61
61
|
"extends": "@2digits"
|