eslint-config-sukka 6.0.0-beta.4 → 6.0.0-beta.5
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.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=t=>Promise.resolve(require(t));var e,r=require("@eslint-sukka/shared"),n=require("node:fs"),s=require("node:path"),o=require("node:process"),i=require("node:url"),a=require("fs"),c=require("local-pkg"),
|
|
1
|
+
"use strict";const t=t=>Promise.resolve(require(t));var e,r=require("@eslint-sukka/shared"),n=require("node:fs"),s=require("node:path"),o=require("node:process"),i=require("node:url"),a=require("fs"),c=require("local-pkg"),l=require("ci-info"),u=(e=Object.create(null),a&&Object.keys(a).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return a[t]}})}}),e.default=a,Object.freeze(e));const p={directory:"isDirectory",file:"isFile"},f=(t,e)=>e[p[t]](),h=t=>t instanceof URL?i.fileURLToPath(t):t;function y(t){return t instanceof URL?i.fileURLToPath(t):t}const d=Symbol("findUpStop");var g=function(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}(u);const m=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),b=/[<>:"|?*\n\r\t\f\x00-\x1F]/,k=/(?:^|\/)[*]{2}($|\/)/,w=t=>"string"==typeof t&&t.length<=248&&!b.test(t),E=t=>String(t).split(/\r\n?|\n/),j=t=>t.startsWith("#"),O=t=>m(t)&&t.patterns&&t.sections,v=(t,e={})=>{let r,n=e.path;if(O(t))return t;w(t)&&g.existsSync(t)&&(n=t,t=g.readFileSync(t));let s=E(t),o=new Map,i={sections:[],patterns:[]},a={name:"default",patterns:[]};for(let t of s){let e=t.trim();if(e.startsWith("#")){let[,t]=/^#+\s*(.*)\s*$/.exec(e);if(r){o.delete(r.name),r.comment+=e?`
|
|
2
2
|
${e}`:"",r.name=t?`${r.name.trim()}
|
|
3
|
-
${t.trim()}`:r.name.trim(),o.set(r.name.toLowerCase().trim(),r);continue}a={name:t.trim(),comment:e,patterns:[]},o.set(a.name.toLowerCase(),a),i.sections.push(a),r=a;continue}""!==e&&(a.patterns.push(e),i.patterns.push(e)),r=null}return(!0===e.dedupe||!0===e.unique)&&(i=
|
|
4
|
-
`).globs())"ignore"===t.type?e.push(...t.patterns):"unignore"===t.type&&e.push(...t.patterns.map(t=>`!${t}`))}if(
|
|
3
|
+
${t.trim()}`:r.name.trim(),o.set(r.name.toLowerCase().trim(),r);continue}a={name:t.trim(),comment:e,patterns:[]},o.set(a.name.toLowerCase(),a),i.sections.push(a),r=a;continue}""!==e&&(a.patterns.push(e),i.patterns.push(e)),r=null}return(!0===e.dedupe||!0===e.unique)&&(i=P(i,{...e,format:!1})),i.path=n,i.input=Buffer.from(t),i.format=t=>x(i,{...e,...t}),i.dedupe=t=>P(i,{...e,...t}),i.globs=t=>L(i,{path:n,...e,...t}),i},P=(t,e)=>{let r;let n=v(t,{...e,dedupe:!1}),s=new Map,o={sections:[],patterns:new Set};for(let t of n.sections){let{name:e="",comment:n,patterns:i}=t,a=e.trim().toLowerCase();for(let t of i)o.patterns.add(t);e&&s.has(a)?(r=s.get(a)).patterns=[...r.patterns,...i]:(r={name:e,comment:n,patterns:i},o.sections.push(r),s.set(a,r))}for(let t of o.sections)t.patterns=[...new Set(t.patterns)];return o.patterns=[...o.patterns],o},S=(t,e)=>{if(k.test(t))return t;let r=!1;return t.startsWith("/")?(t=t.slice(1),r=!0):t.slice(1,t.length-1).includes("/")&&(r=!0),t+=t.endsWith("/")?"**/":"/**",r?t:`**/${t}`},L=(t,e={})=>{let r=v(t,e),n=[],s=0,o=r.patterns.concat(e.ignore||[]).concat((e.unignore||[]).map(t=>t.startsWith("!")?t:"!"+t)),i=(t,r)=>{let o=n[n.length-1],i=t?"unignore":"ignore";o&&o.type===i?o.patterns.includes(r)||o.patterns.push(r):(n.push({type:i,path:e.path||null,patterns:[r],index:s}),s++)};for(let t of o){let e="";t.startsWith("!")&&(t=t.slice(1),e="!"),i(e,t.startsWith("/")?t.slice(1):t),i(e,S(t))}return n},_=(t={})=>{let e=[t.comment||""];return t.patterns?.length&&(e.push(t.patterns.join("\n")),e.push("")),e.join("\n")},x=(t,e={})=>{let r=v(t,e),n=e.formatSection||_,s=r.sections||r,o=[];for(let t of[].concat(s))o.push(n(t));return o.join("\n")};v.file=(t,e)=>v(g.readFileSync(t,"utf8"),e),v.parse=v,v.dedupe=P,v.format=x,v.globs=L,v.formatSection=_,v.patterns=t=>E(t).map(t=>t.trim()).filter(t=>""!==t&&!j(t));var I=v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v;const D=".gitignore";function C(t={}){let e=[],{root:r=!1,files:i=r?D:function(t,e={}){return function(t,e={}){let r=s.resolve(y(e.cwd)??""),{root:i}=s.parse(r),a=s.resolve(r,y(e.stopAt)??i),c=e.limit??Number.POSITIVE_INFINITY,l=[t].flat(),u=t=>(function(t,{cwd:e=o.cwd(),type:r="file",allowSymlinks:i=!0}={}){!function(t){if(!Object.hasOwnProperty.call(p,t))throw Error(`Invalid type specified: ${t}`)}(r),e=h(e);let a=i?n.statSync:n.lstatSync;for(let n of t)try{let t=a(s.resolve(e,n),{throwIfNoEntry:!1});if(!t)continue;if(f(r,t))return n}catch{}})(l,t),g=[];for(;;){let t=u({...e,cwd:r});if(t===d||(t&&g.push(s.resolve(r,t)),r===a||g.length>=c))break;r=s.dirname(r)}return g}(t,{...e,limit:1})[0]}(D)||[],strict:a=!0}=t,c=Array.isArray(i)?i:[i];for(let t of c){let r="";try{r=n.readFileSync(t,"utf8")}catch(t){if(a)throw t;continue}for(let t of I(`${r}
|
|
4
|
+
`).globs())"ignore"===t.type?e.push(...t.patterns):"unignore"===t.type&&e.push(...t.patterns.map(t=>`!${t}`))}if(a&&0===c.length)throw Error("No .gitignore file found");return{ignores:e}}const q=(t={})=>{let{customGlobs:e=null,gitignore:n=[".gitignore"]}=t,s=[],o=[];return!1===e||null===e?o=r.constants.GLOB_EXCLUDE:"function"==typeof e?o=e(r.constants.GLOB_EXCLUDE):"string"==typeof e?o.push(...r.constants.GLOB_EXCLUDE,e):Array.isArray(e)&&o.push(...r.constants.GLOB_EXCLUDE,...e),s.push({ignores:o}),!1===n||null===n||(!0===n?s.push(C({files:[".gitignore"],strict:!1})):("string"==typeof n||Array.isArray(n))&&s.push(C({files:n,strict:!1}))),s};function A(t,e){return"boolean"==typeof t?t:t?.enable??e??!1}function U(t){if("boolean"==typeof t||void 0===t)return;let{enable:e,...r}=t;return r}const $=async(e,...r)=>{let n=e?.isInEditor??!!((process.env.VSCODE_PID||process.env.VSCODE_CWD||process.env.JETBRAINS_IDE||process.env.VIM)&&!l.isCI),s=[];s.push(q(e?.ignores)),A(e?.js,!0)&&s.push((await t("@eslint-sukka/js")).javascript({...U(e?.js),isInEditor:n})),A(e?.json,!0)&&s.push((await t("@eslint-sukka/json")).jsonc());let o=A(e?.ts,c.isPackageExists("typescript"));return o&&s.push((await t("@eslint-sukka/ts")).typescript(U(e?.ts))),A(e?.react,c.isPackageExists("react")||c.isPackageExists("next"))&&(o?s.push((await t("@eslint-sukka/react")).react(U(e?.react))):console.warn("[eslint-config-sukka] React module will not be enabled when TypeScript is not set up.")),A(e?.node,c.isPackageExists("@types/node")||c.isPackageExists("@types/bun"))&&s.push((await t("@eslint-sukka/node")).node(U(e?.node))),A(e?.legacy)&&s.push((await t("@eslint-sukka/legacy")).legacy(U(e?.legacy))),s.push(r),s.flat()};Object.defineProperty(exports,"constants",{enumerable:!0,get:function(){return r.constants}}),exports.ignores=q,exports.sukka=$;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let t=t=>import(t);import{constants as e}from"@eslint-sukka/shared";export{constants}from"@eslint-sukka/shared";import r from"node:fs";import n from"node:path";import s from"node:process";import{fileURLToPath as o}from"node:url";import*as i from"fs";import{isPackageExists as a}from"local-pkg";import{isCI as l}from"ci-info";let p={directory:"isDirectory",file:"isFile"},u=(t,e)=>e[p[t]](),c=t=>t instanceof URL?o(t):t;function f(t
|
|
1
|
+
let t=t=>import(t);import{constants as e}from"@eslint-sukka/shared";export{constants}from"@eslint-sukka/shared";import r from"node:fs";import n from"node:path";import s from"node:process";import{fileURLToPath as o}from"node:url";import*as i from"fs";import{isPackageExists as a}from"local-pkg";import{isCI as l}from"ci-info";let p={directory:"isDirectory",file:"isFile"},u=(t,e)=>e[p[t]](),c=t=>t instanceof URL?o(t):t;function f(t){return t instanceof URL?o(t):t}let h=Symbol("findUpStop");var m=function(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}(i);let y=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),d=/[<>:"|?*\n\r\t\f\x00-\x1F]/,g=/(?:^|\/)[*]{2}($|\/)/,w=t=>"string"==typeof t&&t.length<=248&&!d.test(t),k=t=>String(t).split(/\r\n?|\n/),b=t=>t.startsWith("#"),E=t=>y(t)&&t.patterns&&t.sections,S=(t,e={})=>{let r,n=e.path;if(E(t))return t;w(t)&&m.existsSync(t)&&(n=t,t=m.readFileSync(t));let s=k(t),o=new Map,i={sections:[],patterns:[]},a={name:"default",patterns:[]};for(let t of s){let e=t.trim();if(e.startsWith("#")){let[,t]=/^#+\s*(.*)\s*$/.exec(e);if(r){o.delete(r.name),r.comment+=e?`
|
|
2
2
|
${e}`:"",r.name=t?`${r.name.trim()}
|
|
3
|
-
${t.trim()}`:r.name.trim(),o.set(r.name.toLowerCase().trim(),r);continue}a={name:t.trim(),comment:e,patterns:[]},o.set(a.name.toLowerCase(),a),i.sections.push(a),r=a;continue}""!==e&&(a.patterns.push(e),i.patterns.push(e)),r=null}return(!0===e.dedupe||!0===e.unique)&&(i=
|
|
4
|
-
`).globs())"ignore"===t.type?e.push(...t.patterns):"unignore"===t.type&&e.push(...t.patterns.map(t=>`!${t}`))}if(
|
|
3
|
+
${t.trim()}`:r.name.trim(),o.set(r.name.toLowerCase().trim(),r);continue}a={name:t.trim(),comment:e,patterns:[]},o.set(a.name.toLowerCase(),a),i.sections.push(a),r=a;continue}""!==e&&(a.patterns.push(e),i.patterns.push(e)),r=null}return(!0===e.dedupe||!0===e.unique)&&(i=j(i,{...e,format:!1})),i.path=n,i.input=Buffer.from(t),i.format=t=>L(i,{...e,...t}),i.dedupe=t=>j(i,{...e,...t}),i.globs=t=>O(i,{path:n,...e,...t}),i},j=(t,e)=>{let r;let n=S(t,{...e,dedupe:!1}),s=new Map,o={sections:[],patterns:new Set};for(let t of n.sections){let{name:e="",comment:n,patterns:i}=t,a=e.trim().toLowerCase();for(let t of i)o.patterns.add(t);e&&s.has(a)?(r=s.get(a)).patterns=[...r.patterns,...i]:(r={name:e,comment:n,patterns:i},o.sections.push(r),s.set(a,r))}for(let t of o.sections)t.patterns=[...new Set(t.patterns)];return o.patterns=[...o.patterns],o},v=(t,e)=>{if(g.test(t))return t;let r=!1;return t.startsWith("/")?(t=t.slice(1),r=!0):t.slice(1,t.length-1).includes("/")&&(r=!0),t+=t.endsWith("/")?"**/":"/**",r?t:`**/${t}`},O=(t,e={})=>{let r=S(t,e),n=[],s=0,o=r.patterns.concat(e.ignore||[]).concat((e.unignore||[]).map(t=>t.startsWith("!")?t:"!"+t)),i=(t,r)=>{let o=n[n.length-1],i=t?"unignore":"ignore";o&&o.type===i?o.patterns.includes(r)||o.patterns.push(r):(n.push({type:i,path:e.path||null,patterns:[r],index:s}),s++)};for(let t of o){let e="";t.startsWith("!")&&(t=t.slice(1),e="!"),i(e,t.startsWith("/")?t.slice(1):t),i(e,v(t))}return n},_=(t={})=>{let e=[t.comment||""];return t.patterns?.length&&(e.push(t.patterns.join("\n")),e.push("")),e.join("\n")},L=(t,e={})=>{let r=S(t,e),n=e.formatSection||_,s=r.sections||r,o=[];for(let t of[].concat(s))o.push(n(t));return o.join("\n")};S.file=(t,e)=>S(m.readFileSync(t,"utf8"),e),S.parse=S,S.dedupe=j,S.format=L,S.globs=O,S.formatSection=_,S.patterns=t=>k(t).map(t=>t.trim()).filter(t=>""!==t&&!b(t));var I=S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S;let D=".gitignore";function A(t={}){let e=[],{root:o=!1,files:i=o?D:function(t,e={}){return function(t,e={}){let o=n.resolve(f(e.cwd)??""),{root:i}=n.parse(o),a=n.resolve(o,f(e.stopAt)??i),l=e.limit??Number.POSITIVE_INFINITY,m=[t].flat(),y=t=>(function(t,{cwd:e=s.cwd(),type:o="file",allowSymlinks:i=!0}={}){!function(t){if(!Object.hasOwnProperty.call(p,t))throw Error(`Invalid type specified: ${t}`)}(o),e=c(e);let a=i?r.statSync:r.lstatSync;for(let r of t)try{let t=a(n.resolve(e,r),{throwIfNoEntry:!1});if(!t)continue;if(u(o,t))return r}catch{}})(m,t),d=[];for(;;){let t=y({...e,cwd:o});if(t===h||(t&&d.push(n.resolve(o,t)),o===a||d.length>=l))break;o=n.dirname(o)}return d}(t,{...e,limit:1})[0]}(D)||[],strict:a=!0}=t,l=Array.isArray(i)?i:[i];for(let t of l){let n="";try{n=r.readFileSync(t,"utf8")}catch(t){if(a)throw t;continue}for(let t of I(`${n}
|
|
4
|
+
`).globs())"ignore"===t.type?e.push(...t.patterns):"unignore"===t.type&&e.push(...t.patterns.map(t=>`!${t}`))}if(a&&0===l.length)throw Error("No .gitignore file found");return{ignores:e}}let C=(t={})=>{let{customGlobs:r=null,gitignore:n=[".gitignore"]}=t,s=[],o=[];return!1===r||null===r?o=e.GLOB_EXCLUDE:"function"==typeof r?o=r(e.GLOB_EXCLUDE):"string"==typeof r?o.push(...e.GLOB_EXCLUDE,r):Array.isArray(r)&&o.push(...e.GLOB_EXCLUDE,...r),s.push({ignores:o}),!1===n||null===n||(!0===n?s.push(A({files:[".gitignore"],strict:!1})):("string"==typeof n||Array.isArray(n))&&s.push(A({files:n,strict:!1}))),s};function $(t,e){return"boolean"==typeof t?t:t?.enable??e??!1}function W(t){if("boolean"==typeof t||void 0===t)return;let{enable:e,...r}=t;return r}let x=async(e,...r)=>{let n=e?.isInEditor??!!((process.env.VSCODE_PID||process.env.VSCODE_CWD||process.env.JETBRAINS_IDE||process.env.VIM)&&!l),s=[];s.push(C(e?.ignores)),$(e?.js,!0)&&s.push((await t("@eslint-sukka/js")).javascript({...W(e?.js),isInEditor:n})),$(e?.json,!0)&&s.push((await t("@eslint-sukka/json")).jsonc());let o=$(e?.ts,a("typescript"));return o&&s.push((await t("@eslint-sukka/ts")).typescript(W(e?.ts))),$(e?.react,a("react")||a("next"))&&(o?s.push((await t("@eslint-sukka/react")).react(W(e?.react))):console.warn("[eslint-config-sukka] React module will not be enabled when TypeScript is not set up.")),$(e?.node,a("@types/node")||a("@types/bun"))&&s.push((await t("@eslint-sukka/node")).node(W(e?.node))),$(e?.legacy)&&s.push((await t("@eslint-sukka/legacy")).legacy(W(e?.legacy))),s.push(r),s.flat()};export{C as ignores,x as sukka};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-sukka",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.5",
|
|
4
4
|
"description": "Sukka's ESLint config",
|
|
5
5
|
"homepage": "https://github.com/SukkaW/eslint-config-sukka",
|
|
6
6
|
"repository": {
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"ci-info": "^4.0.0",
|
|
32
32
|
"local-pkg": "^0.5.0",
|
|
33
|
-
"@eslint-sukka/js": "6.0.0-beta.
|
|
34
|
-
"@eslint-sukka/
|
|
35
|
-
"@eslint-sukka/
|
|
33
|
+
"@eslint-sukka/js": "6.0.0-beta.5",
|
|
34
|
+
"@eslint-sukka/shared": "6.0.0-beta.5",
|
|
35
|
+
"@eslint-sukka/json": "6.0.0-beta.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
39
|
-
"@eslint-sukka/legacy": "6.0.0-beta.
|
|
40
|
-
"@eslint-sukka/
|
|
41
|
-
"@eslint-sukka/
|
|
42
|
-
"@eslint-sukka/rollup-config": "6.0.0-beta.
|
|
43
|
-
"@eslint-sukka/ts": "6.0.0-beta.
|
|
39
|
+
"@eslint-sukka/legacy": "6.0.0-beta.5",
|
|
40
|
+
"@eslint-sukka/react": "6.0.0-beta.5",
|
|
41
|
+
"@eslint-sukka/node": "6.0.0-beta.5",
|
|
42
|
+
"@eslint-sukka/rollup-config": "6.0.0-beta.5",
|
|
43
|
+
"@eslint-sukka/ts": "6.0.0-beta.5"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rollup -c rollup.config.ts --configPlugin swc3"
|