@sdlcforge/format-and-lint 1.0.0-alpha.27 → 1.0.0-alpha.29
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/README.md +15 -9
- package/dist/fandl-exec.js +6 -6
- package/dist/fandl-exec.js.map +1 -1
- package/dist/fandl.js +19 -19
- package/dist/fandl.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -142,17 +142,25 @@ Note, the component structure is essentially a prototype at this point. Future v
|
|
|
142
142
|
```
|
|
143
143
|
- places `else if`/`else`/`catch`, etc. on a newline; e.g.:
|
|
144
144
|
```js
|
|
145
|
-
|
|
145
|
+
const foo = bar // fandl style; generally accepted as easier to read
|
|
146
|
+
&& baz
|
|
147
|
+
// vs
|
|
148
|
+
const foo = bar && // prettier style
|
|
149
|
+
baz
|
|
150
|
+
```
|
|
151
|
+
- places `else if`/`else`/`catch`, etc. on a newline; e.g.:
|
|
152
|
+
```js
|
|
153
|
+
if (a === 1) { // fandl style (Stroustrup); more consistent IMO
|
|
146
154
|
...
|
|
147
|
-
}
|
|
148
|
-
else { // and
|
|
149
|
-
|
|
155
|
+
}
|
|
156
|
+
else { // and easier to scan the page
|
|
157
|
+
...
|
|
150
158
|
}
|
|
151
159
|
// vs
|
|
152
|
-
if (a === 1) { // prettier style ("one true brace style")
|
|
160
|
+
if (a === 1) { // prettier default style ("one true brace style")
|
|
153
161
|
...
|
|
154
|
-
}
|
|
155
|
-
|
|
162
|
+
} else { // IMO it's odd to have lexical overhead preceed the flow control keyword
|
|
163
|
+
...
|
|
156
164
|
}
|
|
157
165
|
```
|
|
158
166
|
- aligns the colons in object declarations; e.g.:
|
|
@@ -167,6 +175,4 @@ Note, the component structure is essentially a prototype at this point. Future v
|
|
|
167
175
|
longFieldName : 'how are you?',
|
|
168
176
|
}
|
|
169
177
|
```
|
|
170
|
-
- The dual-formatting is also compatible with the eslint configuration, so the code final format will pass the eslint based lint checking.
|
|
171
|
-
|
|
172
178
|
[^1]: I perhaps falsely remember eslint actually doing a better re indenting code, but in any case there are two issue with the latest eslint based reformatting. First, it miscounts the correct indention level where '('s were involved in boolean expressions. Second, eslint failed automatically break up long lines. (As of @stylistic/eslint-plugin: 2.6.4, eslint: 8.50.0; have since upgraded but not retested since it's working as is.)
|
package/dist/fandl-exec.js
CHANGED
|
@@ -24,14 +24,14 @@ import{find as T}from"find-plus"
|
|
|
24
24
|
import S from"gitignore-to-glob"
|
|
25
25
|
const E=[{name:"files",multiple:!0,description:"A file patterns selecting target files to process. If neither this nor '--files-paths' is specified, then standard, predefined patterns will be used."},{name:"files-paths",multiple:!0,description:"A path to a file containing newline separated file patterns selecting files to process. If neither this nor '--files' is specified, then standard, predefined patterns will be used."},{name:"ignore-files",multiple:!0,description:"A file pattern selecting files to ignore."},{name:"ignore-files-paths",multiple:!0,description:"A path to a file containing a list of newline separated file patterns selecting files to ignore."},{name:"eslint-config-path",description:"Specifies the path to a eslint configuration file to replace the default base eslint configuration."},{name:"eslint-config-components-path",description:"Specifies the path to a configuration file that resolves to an object keyed to 'base', 'jsx', 'node', and 'test' configuration components."},{name:"ignore-package-settings",type:Boolean,description:"Suppresses merging settings from 'package.json:devPkg.linting'."},{name:"no-standard-ignores",type:Boolean,description:"Suppresses default .gitignore and '**/test/data/**/*' ignore patterns."},{name:"root",description:"The directory from which to start looking for files."}],F={arguments:[{name:"command",defaultOption:!0,default:"format-and-lint",description:"The action to perform."},...E],commands:[{name:"format-and-lint",description:"Formats and runs lint checks on the target files.",arguments:[...E,{name:"output-dir",alias:"o",description:"The directory to output the formatted files. This suppresses the default behavior of updating files in place. Output files will be placed relative to the source file and the effective source stem. See '--relative-stem' for details. If for whatever reason there is a name collision, the process will exit in error."},{name:"prettier-config-path",description:"Specifies the path to a prettier configuration file to replace the default configuration as the base prettier configuration."},{name:"relative-stem",description:"The relative stem determines the relative placement of output files when sending output to '--output-dir' (as opposed to the default 'update in place' behavior). E.g., Given input '/usr/foo/project/src/bar/baz.mjs', '--output-dir /tmp/foo', and '--relative-stem /usr/foo/project/src/', the output file will be written to '/tmp/foo/bar/baz.mjs'. By default, the relative stem is the working directory of the process, which can be changed/set manually with this option. If any resolved input file path does not start with the effective effective source stem, the process will exit with an error."}]},{name:"lint",descirption:"Runs lint checks on the target files.",arguments:E},{name:"help",description:"Prints the command help.",arguments:[{name:"command",defaultOption:!0,description:"Optional command specific help."}]},{name:"version",description:"Prints the tool version."}]},I=["block","block-like","break","case","cjs-export","cjs-import","class","const","continue","debugger","default","directive","do","empty","export","expression","for","function","if","iife","import","let","multiline-block-like","multiline-const","multiline-expression","multiline-let","multiline-var","return","singleline-const","singleline-let","singleline-var","switch","throw","try","var","while","with"],L=(...e)=>{const t=[...I]
|
|
26
26
|
for(const i of e)t.splice(t.indexOf(i),1)
|
|
27
|
-
return t},$=[".jsx"],A=[".js",".cjs",".mjs",...$],N=$.join(","),q=A.join(","),
|
|
28
|
-
if(void 0===
|
|
29
|
-
const R=m("./package.json",{encoding:"utf8"}),z=JSON.parse(R),{dependencies:V={},devDependencies:J={},engines:G={node:!0}}=z,M=O({prettier:!0,sortImports:!0,jsx:!0,node:!0,react:!0,typescript:!0}),Q=void 0!==V.react||void 0!==J.react?{version:"detect"}:{},U=C.configs["recommended-flat"],Y=Object.assign({standard:M,import:h,promise:v,n:b},U.plugins),H={...j.configs.recommended.rules,...M.rules,...U.rules,"@stylistic/key-spacing":["error",{align:"colon",afterColon:!0,beforeColon:!0}],"@stylistic/quotes":["error","single",{allowTemplateLiterals:!0,avoidEscape:!0}],"@stylistic/arrow-parens":["error","always"],"@stylistic/array-bracket-newline":["error","consistent"],"@stylistic/array-element-newline":["error","consistent"],"@stylistic/comma-dangle":["error",{arrays:"always-multiline",objects:"always-multiline",imports:"never",exports:"never",functions:"never"}],"@stylistic/function-call-argument-newline":["error","consistent"],"@stylistic/function-call-spacing":["error","never"],"@stylistic/function-paren-newline":["error","consistent"],"@stylistic/indent":["error",2,{ArrayExpression:1,CallExpression:{arguments:1},flatTernaryExpressions:!1,FunctionDeclaration:{body:1,parameters:1},FunctionExpression:{body:1,parameters:1},ignoreComments:!1,ignoredNodes:["TSUnionType","TSIntersectionType","TSTypeParameterInstantiation","FunctionExpression > .params[decorators.length > 0]","FunctionExpression > .params > :matches(Decorator, :not(:first-child))"],ImportDeclaration:1,MemberExpression:1,ObjectExpression:1,offsetTernaryExpressions:!0,outerIIFEBody:1,SwitchCase:1,VariableDeclarator:4}],"@stylistic/linebreak-style":["error","unix"],"@stylistic/max-statements-per-line":["error",{max:2}],"@stylistic/operator-linebreak":["error","before",{overrides:{"=":"after","-=":"after","+=":"after"}}],"@stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"class"},{blankLine:"always",prev:L("cjs-export","export"),next:"export"},{blankLine:"always",prev:L("cjs-export","export"),next:"cjs-export"},{blankLine:"always",prev:"import",next:L("import")},{blankLine:"always",prev:"cjs-import",next:L("cjs-import","const","let","singleline-const","singleline-let","singleline-var","var")},{blankLine:"always",prev:"*",next:"return"}],"@stylistic/semi-style":["error","first"],"@stylistic/space-before-function-paren":["error",{anonymous:"always",asyncArrow:"always",named:"never"}],"@stylistic/switch-colon-spacing":["error",{after:!0,before:!1}],"import/export":"off","no-unused-vars":["error",{varsIgnorePattern:"React"}],"prefer-regex-literals":"error",yoda:["error","never"],"no-console":"error","no-await-in-loop":"error","no-lonely-if":"error","no-return-assign":"error","no-shadow":"error","no-extra-label":"error","no-label-var":"error","no-invalid-this":"error","no-unreachable-loop":"error","no-extra-bind":"error","require-await":"error","consistent-return":"error","default-case-last":"error",eqeqeq:"error",complexity:["error",20],"max-depth":["error",4],"max-lines":["error",{max:300,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":["error",{max:50,skipBlankLines:!0,skipComments:!0}]}
|
|
27
|
+
return t},$=[".jsx"],A=[".js",".cjs",".mjs",...$],N=$.join(","),q=A.join(","),W=l(g(import.meta.url)),_=c(W,"babel","babel.config.cjs"),B=c("dist","babel","babel.config.cjs"),D=!0===d(_)?_:d(B)?B:void 0
|
|
28
|
+
if(void 0===D)throw new Error("Could not find babel config file.")
|
|
29
|
+
const R=m("./package.json",{encoding:"utf8"}),z=JSON.parse(R),{dependencies:V={},devDependencies:J={},engines:G={node:!0}}=z,M=O({prettier:!0,sortImports:!0,jsx:!0,node:!0,react:!0,typescript:!0}),Q=void 0!==V.react||void 0!==J.react?{version:"detect"}:{},U=C.configs["recommended-flat"],Y=Object.assign({standard:M,import:h,promise:v,n:b},U.plugins),H={...j.configs.recommended.rules,...M.rules,...U.rules,"@stylistic/key-spacing":["error",{align:"colon",afterColon:!0,beforeColon:!0}],"@stylistic/quotes":["error","single",{allowTemplateLiterals:!0,avoidEscape:!0}],"@stylistic/arrow-parens":["error","always"],"@stylistic/array-bracket-newline":["error","consistent"],"@stylistic/array-element-newline":["error","consistent"],"@stylistic/comma-dangle":["error",{arrays:"always-multiline",objects:"always-multiline",imports:"never",exports:"never",functions:"never"}],"@stylistic/function-call-argument-newline":["error","consistent"],"@stylistic/function-call-spacing":["error","never"],"@stylistic/function-paren-newline":["error","consistent"],"@stylistic/indent":["error",2,{ArrayExpression:1,CallExpression:{arguments:1},flatTernaryExpressions:!1,FunctionDeclaration:{body:1,parameters:1},FunctionExpression:{body:1,parameters:1},ignoreComments:!1,ignoredNodes:["TSUnionType","TSIntersectionType","TSTypeParameterInstantiation","FunctionExpression > .params[decorators.length > 0]","FunctionExpression > .params > :matches(Decorator, :not(:first-child))"],ImportDeclaration:1,MemberExpression:1,ObjectExpression:1,offsetTernaryExpressions:!0,outerIIFEBody:1,SwitchCase:1,VariableDeclarator:4}],"@stylistic/linebreak-style":["error","unix"],"@stylistic/max-statements-per-line":["error",{max:2}],"@stylistic/operator-linebreak":["error","before",{overrides:{"=":"after","-=":"after","+=":"after"}}],"@stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"class"},{blankLine:"always",prev:L("cjs-export","export"),next:"export"},{blankLine:"always",prev:L("cjs-export","export"),next:"cjs-export"},{blankLine:"always",prev:"import",next:L("import")},{blankLine:"always",prev:"cjs-import",next:L("cjs-import","const","let","singleline-const","singleline-let","singleline-var","var")},{blankLine:"always",prev:"*",next:"return"}],"@stylistic/semi-style":["error","first"],"@stylistic/space-before-function-paren":["error",{anonymous:"always",asyncArrow:"always",named:"never"}],"@stylistic/switch-colon-spacing":["error",{after:!0,before:!1}],"import/export":"off","import/extensions":["error","never",{svg:"always"}],"no-unused-vars":["error",{varsIgnorePattern:"React"}],"prefer-regex-literals":"error",yoda:["error","never"],"no-console":"error","no-await-in-loop":"error","no-lonely-if":"error","no-return-assign":"error","no-shadow":"error","no-extra-label":"error","no-label-var":"error","no-invalid-this":"error","no-unreachable-loop":"error","no-extra-bind":"error","require-await":"error","consistent-return":"error","default-case-last":"error",eqeqeq:"error",complexity:["error",20],"max-depth":["error",4],"max-lines":["error",{max:300,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":["error",{max:50,skipBlankLines:!0,skipComments:!0}]}
|
|
30
30
|
delete H["block-spacing"],delete H["brace-style"],delete H["comma-dangle"],delete H["eol-last"],delete H.indent,delete H["indent-binary-ops"],delete H["key-spacing"],delete H["operator-linebreak"],delete H["no-trailing-spaces"],delete H["space-before-function-paren"],delete H["@stylistic/indent-binary-ops"],delete H["quote-props"]
|
|
31
|
-
const K=[`**/*{${q}}`],X={files:K,languageOptions:{parser:x,parserOptions:{sourceType:"module",requireConfigFile:!0,babelOptions:{configFile:
|
|
31
|
+
const K=[`**/*{${q}}`],X={files:K,languageOptions:{parser:x,parserOptions:{sourceType:"module",requireConfigFile:!0,babelOptions:{configFile:D},ecmaFeatures:{jsx:!0}},ecmaVersion:"latest"},settings:{react:Q},plugins:Y,rules:H}
|
|
32
32
|
void 0!==G?.node&&(X.plugins.node=k(y),X.languageOptions.globals=u.node,Object.assign(X.rules,{...y.configs.recommended.rules,"node/no-unsupported-features/es-syntax":"off","node/prefer-promises/dns":"error","node/prefer-promises/fs":"error","node/no-missing-import":["error",{tryExtensions:A}]}))
|
|
33
|
-
const Z={files:K,ignores:[`**/index{${q}}`,"**/__tests__/**/*","**/*.test.*"],plugins:{jsdoc:w},rules:{...w.configs["flat/recommended-error"].rules,"jsdoc/require-description":"error","jsdoc/no-defaults":"off","jsdoc/check-tag-names":["error",{definedTags:["category"]}]}},ee={files:[`**/*{${N}}`],languageOptions:{globals:u.browser}},te={files:["**/_tests_/**",`**/*.test{${q}}`],languageOptions:{globals:u.jest},rules:{"max-lines-per-function":"off"}},ie=({check:e,eslintConfig:i,eslintConfigComponents:n})=>{if(void 0!==i&&void 0!==n)throw new t({message:"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously."})
|
|
34
|
-
return void 0===i&&(i=(({additional:e={},base:t=X,jsdoc:i=Z,jsx:n=ee,test:r=te}={})=>[t,i,n,r,e])(n)),new f({fix:!1===e,overrideConfigFile:!0,overrideConfig:i,cwd:"/"})},ne={arrowParens:"always",bracketSpacing:!0,semi:!1,singleQuote:!0,trailingComma:"es5"},re=async e=>{const{check:t=!1,eslintConfig:n,eslintConfigComponents:r,prettierConfig:o=ne}=e
|
|
33
|
+
const Z={files:K,ignores:[`**/index{${q}}`,"**/__tests__/**/*","**/*.test.*"],plugins:{jsdoc:w},rules:{...w.configs["flat/recommended-error"].rules,"jsdoc/require-description":"error","jsdoc/no-defaults":"off","jsdoc/check-tag-names":["error",{definedTags:["category"]}]}},ee={files:[`**/*{${N}}`],languageOptions:{globals:u.browser}},te={files:["**/_tests_/**",`**/*.test{${q}}`],languageOptions:{globals:u.jest},rules:{"max-lines-per-function":"off","max-lines":["error",{max:500,skipBlankLines:!0,skipComments:!0}]}},ie=({check:e,eslintConfig:i,eslintConfigComponents:n})=>{if(void 0!==i&&void 0!==n)throw new t({message:"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously."})
|
|
34
|
+
return void 0===i&&(i=(({additional:e={},base:t=X,jsdoc:i=Z,jsx:n=ee,test:r=te}={})=>[t,i,n,r,e])(n)),new f({fix:!1===e,overrideConfigFile:!0,overrideConfig:i,cwd:"/"})},ne={arrowParens:"always",bracketSpacing:!0,printWidth:120,semi:!1,singleQuote:!0,trailingComma:"es5"},re=async e=>{const{check:t=!1,eslintConfig:n,eslintConfigComponents:r,prettierConfig:o=ne}=e
|
|
35
35
|
if(void 0===e.files||0===e.files.length)throw new i({argumentName:"files",argumentType:"string[]",argumentValue:e.files})
|
|
36
36
|
const s=e.files.map(e=>a.resolve(e)),l=Object.assign({},e)
|
|
37
37
|
void 0===l.eslint&&(l.eslint=ie({check:t,eslintConfig:n,eslintConfigComponents:r}))
|
package/dist/fandl-exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fandl-exec.js","sources":["../src/cli/cli-spec.mjs","../src/lib/default-config/lib/linebreak-types-except.mjs","../src/lib/default-config/js-extensions.mjs","../src/lib/default-config/eslint-config.mjs","../src/lib/lib/get-eslint.mjs","../src/lib/default-config/prettier.config.mjs","../src/lib/format-and-lint.mjs","../src/cli/lib/process-config-file.mjs","../src/lib/lib/extract-patterns-from-file.mjs","../src/lib/lib/process-file-patterns.mjs","../src/lib/lib/select-files-from-options.mjs","../src/lib/lib/process-gitignore.mjs","../src/lib/lib/process-package-ignores.mjs","../src/cli/fandl.mjs","../src/cli/index.mjs"],"sourcesContent":["const lintArgs = [\n {\n name : 'files',\n multiple : true,\n description :\n \"A file patterns selecting target files to process. If neither this nor '--files-paths' is specified, then standard, predefined patterns will be used.\",\n },\n {\n name : 'files-paths',\n multiple : true,\n description :\n \"A path to a file containing newline separated file patterns selecting files to process. If neither this nor '--files' is specified, then standard, predefined patterns will be used.\",\n },\n {\n name : 'ignore-files',\n multiple : true,\n description : 'A file pattern selecting files to ignore.',\n },\n {\n name : 'ignore-files-paths',\n multiple : true,\n description :\n 'A path to a file containing a list of newline separated file patterns selecting files to ignore.',\n },\n {\n name : 'eslint-config-path',\n description :\n 'Specifies the path to a eslint configuration file to replace the default base eslint configuration.',\n },\n {\n name : 'eslint-config-components-path',\n description :\n \"Specifies the path to a configuration file that resolves to an object keyed to 'base', 'jsx', 'node', and 'test' configuration components.\",\n },\n {\n name : 'ignore-package-settings',\n type : Boolean,\n description :\n \"Suppresses merging settings from 'package.json:devPkg.linting'.\",\n },\n {\n name : 'no-standard-ignores',\n type : Boolean,\n description :\n \"Suppresses default .gitignore and '**/test/data/**/*' ignore patterns.\",\n },\n {\n name : 'root',\n description : 'The directory from which to start looking for files.',\n },\n]\n\nconst cliSpec = {\n mainCommand : 'fandl',\n description :\n 'Optimized, single command out of the box JavaScript format and lint tool.',\n arguments : [\n {\n name : 'command',\n defaultOption : true,\n default : 'format-and-lint',\n description : 'The action to perform.',\n },\n ...lintArgs,\n ],\n commands : [\n {\n name : 'format-and-lint',\n description : 'Formats and runs lint checks on the target files.',\n arguments : [\n ...lintArgs,\n {\n name : 'output-dir',\n alias : 'o',\n description :\n \"The directory to output the formatted files. This suppresses the default behavior of updating files in place. Output files will be placed relative to the source file and the effective source stem. See '--relative-stem' for details. If for whatever reason there is a name collision, the process will exit in error.\",\n },\n {\n name : 'prettier-config-path',\n description :\n 'Specifies the path to a prettier configuration file to replace the default configuration as the base prettier configuration.',\n },\n {\n name : 'relative-stem',\n description :\n \"The relative stem determines the relative placement of output files when sending output to '--output-dir' (as opposed to the default 'update in place' behavior). E.g., Given input '/usr/foo/project/src/bar/baz.mjs', '--output-dir /tmp/foo', and '--relative-stem /usr/foo/project/src/', the output file will be written to '/tmp/foo/bar/baz.mjs'. By default, the relative stem is the working directory of the process, which can be changed/set manually with this option. If any resolved input file path does not start with the effective effective source stem, the process will exit with an error.\",\n },\n ],\n },\n {\n name : 'lint',\n descirption : 'Runs lint checks on the target files.',\n arguments : lintArgs,\n },\n /* { name: 'show-eslint-config', description: 'Prints the effective eslint configuration to stdout.', arguments: globalArguments },\n { name: 'show-prettier-config', description: 'Prints the effective prettier configuration to stdout.', arguments: globalArguments }, */\n {\n name : 'help',\n description : 'Prints the command help.',\n arguments : [\n {\n name : 'command',\n defaultOption : true,\n description : 'Optional command specific help.',\n },\n ],\n },\n { name : 'version', description : 'Prints the tool version.' },\n ],\n}\n\nexport { cliSpec }\n","const linebreakTypes = [\n 'block',\n 'block-like',\n 'break',\n 'case',\n 'cjs-export',\n 'cjs-import',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'directive',\n 'do',\n 'empty',\n 'export',\n 'expression',\n 'for',\n 'function',\n 'if',\n 'iife',\n 'import',\n 'let',\n 'multiline-block-like',\n 'multiline-const',\n 'multiline-expression',\n 'multiline-let',\n 'multiline-var',\n 'return',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'switch',\n 'throw',\n 'try',\n 'var',\n 'while',\n 'with',\n]\n\n/**\n * A helper function used to sanely build 'blankline' entries in the '@stylistic/padding-line-between-statements' rule.\n * Basically, what we often want is to say \"we want a blank line between expression type A and all other expression\n * except for B, C, and D.\" This is useful because the '@stylistic/padding-line-between-statements' rule requires you\n * specify each type where a blank line is required, but it's generally easier to specify a set of expression types for\n * which a blank line is _NOT_ required.E.g.:\n *\n * ```javascript\n * '@stylistic/padding-line-between-statements' : [\n * 'error',\n * { blankLine : 'always', prev : '*', next : 'class' },\n * {\n * blankLine : 'always',\n * prev : linebreakTypesExcept('cjs-export', 'export'),\n * next : 'export',\n * },\n * ]\n * ```\n *\n * Would require (and/or add) a blank line between a class declaration and anything else, and a blank line between\n * `import` statements and all other statements except `import` or `cjs-import` statements. That way, all your `import`\n * statements would be grouped together, but would have a blank line between the last `import` and whatever the next\n * non-import statement is.\n * @param {...string} types - A list of the types to exclude from the rule (meaning all other known types are included).\n * @returns {string[]} - An array of the non-excluded types.\n */\nconst linebreakTypesExcept = (...types) => {\n const result = [...linebreakTypes]\n for (const type of types) {\n result.splice(result.indexOf(type), 1)\n }\n\n return result\n}\n\nexport { linebreakTypesExcept }\n","export const stdExts = ['.js', '.cjs', '.mjs']\nexport const jsxExts = ['.jsx']\nexport const allExts = [...stdExts, ...jsxExts]\nexport const stdExtsStr = stdExts.join(',')\nexport const jsxExtsStr = jsxExts.join(',')\nexport const allExtsStr = allExts.join(',')\n","/**\n * @file ESLint configuration file implementing (almost) [Standard JS style]{@link https://standardjs.com/},\n * [ESLint recommended js rules]{@link https://eslint.org/docs/latest/rules/},\n * [jsdoc rules]{@link https://www.npmjs.com/package/eslint-plugin-jsdoc} and, when appropriate,\n * [recommended node]{@link https://www.npmjs.com/package/eslint-plugin-node} and\n * [react]{@link https://www.npmjs.com/package/eslint-plugin-react} rules as well.\n *\n * Our one exception to the standard style is implementing aligned colons on multiline\n * 'key-spacing'. We think it makes things more readable. We also add a preference for regex literals where possible.\n */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport globalsPkg from 'globals'\nimport importPlugin from 'eslint-plugin-import'\nimport jsdocPlugin from 'eslint-plugin-jsdoc'\nimport nodePlugin from 'eslint-plugin-node'\nimport promisePlugin from 'eslint-plugin-promise'\nimport nPlugin from 'eslint-plugin-n'\nimport babelParser from '@babel/eslint-parser'\nimport { fixupPluginRules } from '@eslint/compat'\nimport js from '@eslint/js'\nimport stylistic from '@stylistic/eslint-plugin'\nimport standardConfig from 'eslint-config-standard-kit'\n\nimport { linebreakTypesExcept } from './lib/linebreak-types-except'\nimport { allExts, allExtsStr, jsxExtsStr } from './js-extensions'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\nconst babelConfigPathInstalled = join(__dirname, 'babel', 'babel.config.cjs')\nconst babelConfigPathTest = join('dist', 'babel', 'babel.config.cjs')\n\nconst babelConfigPath =\n existsSync(babelConfigPathInstalled) === true\n ? babelConfigPathInstalled\n : existsSync(babelConfigPathTest)\n ? babelConfigPathTest\n : undefined\nif (babelConfigPath === undefined) {\n throw new Error('Could not find babel config file.')\n}\n\nconst packageContents = readFileSync('./package.json', { encoding : 'utf8' })\nconst packageJSON = JSON.parse(packageContents)\nconst {\n dependencies = {},\n devDependencies = {},\n engines = { node : true },\n} = packageJSON\n\nconst standardPlugin = standardConfig({\n prettier : true,\n sortImports : true,\n jsx : true,\n node : true,\n react : true,\n typescript : true,\n})\n\nconst usesReact =\n dependencies.react !== undefined || devDependencies.react !== undefined\nconst reactSettings = usesReact ? { version : 'detect' } : {}\n\nconst stylisticConfig = stylistic.configs['recommended-flat']\n\nconst plugins = Object.assign(\n {\n standard : standardPlugin,\n import : importPlugin,\n promise : promisePlugin,\n n : nPlugin,\n },\n stylisticConfig.plugins // this names the plugin '@stylistic'\n)\n\nconst rules = {\n ...js.configs.recommended.rules,\n ...standardPlugin.rules,\n ...stylisticConfig.rules, // the stylistic rules also cover react rules\n // override key spacing to get things aligned\n '@stylistic/key-spacing' : [\n 'error',\n { align : 'colon', afterColon : true, beforeColon : true },\n ],\n // override to allow avoiding escapes\n '@stylistic/quotes' : [\n 'error',\n 'single',\n { allowTemplateLiterals : true, avoidEscape : true },\n ],\n // additional rules\n '@stylistic/arrow-parens' : ['error', 'always'], // I like this to be consistent\n '@stylistic/array-bracket-newline' : ['error', 'consistent'],\n '@stylistic/array-element-newline' : ['error', 'consistent'],\n '@stylistic/comma-dangle' : [\n 'error',\n {\n arrays : 'always-multiline',\n objects : 'always-multiline',\n imports : 'never',\n exports : 'never',\n functions : 'never',\n },\n ],\n '@stylistic/function-call-argument-newline' : ['error', 'consistent'],\n '@stylistic/function-call-spacing' : ['error', 'never'],\n '@stylistic/function-paren-newline' : ['error', 'consistent'],\n '@stylistic/indent' : [\n 'error',\n 2,\n {\n ArrayExpression : 1,\n CallExpression : { arguments : 1 },\n flatTernaryExpressions : false,\n FunctionDeclaration : { body : 1, parameters : 1 },\n FunctionExpression : { body : 1, parameters : 1 },\n ignoreComments : false,\n ignoredNodes : [\n 'TSUnionType',\n 'TSIntersectionType',\n 'TSTypeParameterInstantiation',\n 'FunctionExpression > .params[decorators.length > 0]',\n 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',\n ],\n ImportDeclaration : 1,\n MemberExpression : 1,\n ObjectExpression : 1,\n offsetTernaryExpressions : true,\n outerIIFEBody : 1,\n SwitchCase : 1,\n VariableDeclarator : 4,\n },\n ],\n '@stylistic/linebreak-style' : ['error', 'unix'],\n // '@stylistic/indent-binary-ops': ['error', 4], // same as default, but since we define indent, these two go together\n '@stylistic/max-statements-per-line' : ['error', { max : 2 }], // allow for short one-liners\n // The default is just 'before'; but equals are special. IMO.\n '@stylistic/operator-linebreak' : [\n 'error',\n 'before',\n { overrides : { '=' : 'after', '-=' : 'after', '+=' : 'after' } },\n ],\n '@stylistic/padding-line-between-statements' : [\n 'error',\n { blankLine : 'always', prev : '*', next : 'class' },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'export',\n },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'cjs-export',\n },\n {\n blankLine : 'always',\n prev : 'import',\n next : linebreakTypesExcept('import'),\n },\n {\n blankLine : 'always',\n prev : 'cjs-import',\n // Because a cjs-import is actually many different things...\n next : linebreakTypesExcept(\n 'cjs-import',\n 'const',\n 'let',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'var'\n ),\n },\n { blankLine : 'always', prev : '*', next : 'return' },\n ],\n // prettier insists on putting required semi-colons first, which is probably the better answer since it's more\n // resilient to code changes\n '@stylistic/semi-style' : ['error', 'first'],\n // The @stylistic default of 'always' for all seems at odd with general standards, which don't have space before\n // named functions. I like that because when we invoke a function, you never see a space, and I see no reason to\n // write the declaration different.\n '@stylistic/space-before-function-paren' : [\n 'error',\n { anonymous : 'always', asyncArrow : 'always', named : 'never' },\n ],\n '@stylistic/switch-colon-spacing' : ['error', { after : true, before : false }],\n // one-true-brace-style /is/ the more common, but i just don't like it. I think Stroustrup is easier to read *and*,\n // most important, with 1tbs, you can't do these kind of comments:\n //\n // if { ...\n // } // I really like to be able to put comments here\n // else if (some really conditional that means we'd have to put our comment inside the else-if!) {...}\n //\n // and I do those kind of comments sometime.\n // 'standard/brace-style' : ['errer', 'stroustrup', { allowSingleLine: true }],\n // TODO; looks like it's failing on the `export * from './foo'` statements; even though we have the babel pluggin`\n 'import/export' : 'off',\n // the standard 'no-unused-vars ignores unused args, which we'd rather catch. We also want to exclude 'React',\n // which we need to import for react to work, even when not used\n 'no-unused-vars' : ['error', { varsIgnorePattern : 'React' }],\n // style/consistency rules\n // this modifies JS Standard style\n 'prefer-regex-literals' : 'error',\n 'yoda' : ['error', 'never'],\n // use 'process.stdout'/'process.stderr' when you really want to communicate to the user\n 'no-console' : 'error',\n // efficiency rules\n 'no-await-in-loop' : 'error',\n // rules for odd code/possible red flags/unintentional logic\n 'no-lonely-if' : 'error',\n 'no-return-assign' : 'error',\n 'no-shadow' : 'error',\n 'no-extra-label' : 'error',\n 'no-label-var' : 'error',\n 'no-invalid-this' : 'error',\n 'no-unreachable-loop' : 'error',\n 'no-extra-bind' : 'error',\n 'require-await' : 'error',\n 'consistent-return' : 'error',\n 'default-case-last' : 'error',\n 'eqeqeq' : 'error',\n // limit code complexity\n 'complexity' : ['error', 20], // default val\n 'max-depth' : ['error', 4], // default val\n 'max-lines' : [\n 'error',\n { max : 300, skipBlankLines : true, skipComments : true },\n ], // default val,\n 'max-lines-per-function' : [\n 'error',\n { max : 50, skipBlankLines : true, skipComments : true },\n ],\n}\n\n// OK, so the standard plugin provides lots of nice rules, but there are some conflicts, so we delete them (and let the\n// @stylistic rules control).\ndelete rules['block-spacing'] // redundant with @stylistic\ndelete rules['brace-style'] // they want 1tbs, we want stroustrup\ndelete rules['comma-dangle'] // they so no, we say multiline\ndelete rules['eol-last'] // redundant with @stylistic\ndelete rules.indent\ndelete rules['indent-binary-ops']\ndelete rules['key-spacing'] // redundant with @stylistic\ndelete rules['operator-linebreak'] // they say after, we say before\ndelete rules['no-trailing-spaces'] // doesn't conflict, but it's redundant with @stylistic\ndelete rules['space-before-function-paren'] // we override default and redundant anyway\ndelete rules['@stylistic/indent-binary-ops'] // this is handled better by prettier\n// deprecated rules\ndelete rules['quote-props']\n\nconst allFiles = [`**/*{${allExtsStr}}`]\n\nconst defaultBaseConfig = {\n files : allFiles,\n languageOptions : {\n parser : babelParser,\n parserOptions : {\n sourceType : 'module',\n requireConfigFile : true,\n babelOptions : { configFile : babelConfigPath },\n ecmaFeatures : { jsx : true },\n },\n ecmaVersion : 'latest',\n },\n settings : { react : reactSettings },\n plugins,\n rules,\n}\n\nif (engines?.node !== undefined) {\n defaultBaseConfig.plugins.node = fixupPluginRules(nodePlugin)\n // TODO: actually, we don't want this for MJS files... but I'm not sure what we do want\n defaultBaseConfig.languageOptions.globals = globalsPkg.node\n Object.assign(defaultBaseConfig.rules, {\n ...nodePlugin.configs.recommended.rules,\n 'node/no-unsupported-features/es-syntax' : 'off', // we expect teh code to run through Babel, so it's fine\n 'node/prefer-promises/dns' : 'error',\n 'node/prefer-promises/fs' : 'error',\n 'node/no-missing-import' : [\n 'error',\n {\n tryExtensions : allExts,\n },\n ],\n })\n}\n\nconst defaultJsdocConfig = {\n files : allFiles,\n ignores : [`**/index{${allExtsStr}}`, '**/__tests__/**/*', '**/*.test.*'],\n plugins : { jsdoc : jsdocPlugin },\n rules : {\n ...jsdocPlugin.configs['flat/recommended-error'].rules,\n 'jsdoc/require-description' : 'error',\n // there is some indication that jsdoc should be able to divine default from ES6 default parameter settings (\n // e.g., func(foo = true)), but if this is possible, it's not working for us. (Prior to 2025)\n 'jsdoc/no-defaults' : 'off',\n // allow the dmd-readme-api plugin to define the 'category' tag\n 'jsdoc/check-tag-names' : ['error', { definedTags : ['category'] }],\n },\n}\n\nconst defaultJsxConfig = {\n files : [`**/*{${jsxExtsStr}}`],\n // add necessary globals when processing JSX files\n languageOptions : { globals : globalsPkg.browser },\n}\n\nconst defaultTestsConfig = {\n files : ['**/_tests_/**', `**/*.test{${allExtsStr}}`],\n // adds correct globals when processing jest tests\n languageOptions : { globals : globalsPkg.jest },\n rules : {\n // override default check for tests; Jest 'describe' functions can get very long, and that's OK\n 'max-lines-per-function' : 'off',\n },\n}\n\nconst getEslintConfig = ({\n additional = {},\n base = defaultBaseConfig,\n jsdoc = defaultJsdocConfig,\n jsx = defaultJsxConfig,\n test = defaultTestsConfig,\n} = {}) => {\n const eslintConfig = [base, jsdoc, jsx, test, additional]\n\n return eslintConfig\n}\n\nexport { getEslintConfig }\n","import { ESLint } from 'eslint'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { getEslintConfig } from '../default-config/eslint-config'\n\nconst getEslint = ({ check, eslintConfig, eslintConfigComponents }) => {\n if (eslintConfig !== undefined && eslintConfigComponents !== undefined) {\n throw new ArgumentInvalidError({\n message :\n \"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously.\",\n })\n }\n\n if (eslintConfig === undefined) {\n eslintConfig = getEslintConfig(eslintConfigComponents)\n }\n\n return new ESLint({\n fix : check === false,\n // this keeps eslint from insisting on an eslint config file\n overrideConfigFile : true,\n overrideConfig : eslintConfig,\n // This isn't necessary right now, but logically, it makes more sense. The difference is whether eslint looks for\n // config files relative to the base path (see below) or the file itself. In future, if/when we support config\n // override/augmentation, it makes sense to do it relative to the file, I think.\n // flags: ['unstable_config_lookup_from_file'],\n // By default, eslint sets the 'base path' to the CWD of the process and if the linted file isn't under the 'base\n // path', it is ignored. However, we expect either absolute file paths (from 'formatAndLint') or create absolute\n // file paths ourselves (from fandl CLI), so we set 'cwd' to '/' so no files are reject on that basis.\n cwd : '/',\n })\n}\n\nexport { getEslint }\n","const prettierConfig = {\n arrowParens : 'always',\n bracketSpacing : true,\n semi : false,\n singleQuote : true,\n trailingComma : 'es5',\n}\n\nexport { prettierConfig }\n","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport * as path from 'node:path'\n\nimport { format as prettierFormat } from 'prettier'\nimport { ArgumentInvalidError, ArgumentMissingError } from 'standard-error-set'\n\nimport { getEslint } from './lib/get-eslint'\nimport { prettierConfig as defaultPrettierConfig } from './default-config/prettier.config'\n\n/**\n * Parses, lints, and (when `check` is false) reformats the `files` text. By default, this function will update the\n * `files` in-place.\n * @param {object} options - The input options.\n * @param {boolean} [options.check = false] - If `true` then the files are linted, but not reformatted.\n * @param {boolean} [options.noWrite = false] - If `true`, then the files are not updated in placed. Has no effect when\n * `check = false`, but when combined with `check = true`, means that the text is reformatted and attached to the\n * `LintResult`s, but the files themselves are not updated. You can access reformatted text as part of the\n * `result.lintResults[0].output`. Unlike results directly from `ESLint`, `output` is\n * always present on the `LintResult` object (rather than only being set if the text is changed.\n * @param {object} [options.eslintConfig = <default eslint config>] - A flat (9.x) style array of [eslint configuration\n * object](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects) to be used in\n * place of the default, out of the box configuration. This may not be specified along with `eslintConfigComponents`.\n * @param {object} [options.eslintConfigComponents = undefined] - An object with zero or more keys corresponding to the\n * `base`, `jsdoc`, `jsx`, `test`, or `additional` as discussed in the [component based\n * configuration](#component-based-configuration). This may not be specified along with `eslintConfig`.\n * @param {object} [options.prettierConfig = <default prettier config>] - A prettier [options\n * object](https://prettier.io/docs/en/options).\n * @param {object} [options.eslint = undefined] - A pre-configured\n * [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class) instance. If this is defined, then\n * `eslintConfig` and `eslintConfigComponents` will be ignored.\n * @param {string} [options.outputDir = undefined] - If provided, then output files (whether reformatted or not) will be\n * written to the specified directory relative to their location in the source. With `src/index.mjs` =>\n * `<outputDir>/src/index.mjs`, `src/foo/bar.mjs` => `<outputDir>/src/foo/bar.mjs`. This option has no effect if\n * `check = true` or `noWrite = true`. The relative starting point is controlled with the `relativeStem` option.\n * @param {string} [options.relativeStem = process.cwd()] - Controls the starting point for determining the relative\n * position of files when emitting to `outputDir` rather than updating in place. Impossible stems will result in an\n * error. E.g., given file `src/index.mjs`, `relativeStem = 'src/foo'` is invalid.\n * @returns {Promise<{eslint: object, lintResults: object[]}>} Resolves to an object with two fields. `eslint` points\n * to the an instance of [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class). `lintResults`\n * points to an array of [`LintResult`](https://eslint.org/docs/latest/integrate/nodejs-api#-lintresult-type)s.\n */\nconst formatAndLint = async (options) => {\n const {\n // see 'processSource' for additional options\n check = false,\n eslintConfig,\n eslintConfigComponents,\n prettierConfig = defaultPrettierConfig,\n } = options\n\n if (options.files === undefined || options.files.length === 0) {\n throw new ArgumentMissingError({\n argumentName : 'files',\n argumentType : 'string[]',\n argumentValue : options.files,\n })\n }\n\n // make files absolute\n const files = options.files.map((f) => path.resolve(f))\n\n const processOptions = Object.assign({}, options)\n\n if (processOptions.eslint === undefined) {\n processOptions.eslint = getEslint({\n check,\n eslintConfig,\n eslintConfigComponents,\n })\n }\n\n const prettierParseConfig = structuredClone(prettierConfig)\n prettierParseConfig.parser = 'babel'\n processOptions.prettierConfig = prettierParseConfig\n\n const lintResults = (\n await Promise.all(files.map((file) => processSource(file, processOptions)))\n ).flat()\n\n return { eslint : processOptions.eslint, lintResults }\n}\n\nconst processSource = async (\n file,\n {\n check = false,\n eslint,\n noWrite = false,\n outputDir,\n prettierConfig,\n relativeStem = process.cwd(),\n }\n) => {\n const readPromise = readFile(file, { encoding : 'utf8' })\n const inputSource = await readPromise\n const prettierSource =\n check === true\n ? inputSource\n : await prettierFormat(inputSource, prettierConfig)\n const lintResults = await eslint.lintText(\n // we must specify the file path in order for the proper rules from the flat config to attach\n prettierSource,\n { filePath : file }\n )\n\n // the output is undefined if there are no changes due to the linting, but there may be changes due to prettier, so\n // to keep the ultimate result consistent, we have to update output if prettier did something\n if (lintResults[0].output === undefined && prettierSource !== inputSource) {\n lintResults[0].output = prettierSource\n }\n const formattedText = lintResults[0].output\n\n if (\n check !== true\n && noWrite !== true\n && (formattedText !== undefined || outputDir !== undefined)\n ) {\n let outputPath = file\n if (outputDir !== undefined) {\n if (!file.startsWith(outputPath)) {\n throw new ArgumentInvalidError({\n message : `Resolved input file path '${file}' does not start with effective source stem '${relativeStem}'.`,\n hint : \"Check input file paths/selection patterns and set or harmonize '--relative-stem' option if necessary.\",\n })\n }\n\n let relPath = file.slice(relativeStem.length)\n if (relPath.startsWith(path.sep)) {\n relPath = relPath.slice(1)\n }\n outputPath = path.join(outputDir, relPath)\n\n await mkdir(path.dirname(outputPath), { recursive : true })\n }\n\n const outputText = formattedText || prettierSource\n await writeFile(outputPath, outputText, { encoding : 'utf8' })\n }\n\n return lintResults\n}\n\nexport { formatAndLint }\n","import { readFile } from 'node:fs/promises'\n\nimport yaml from 'js-yaml'\n\nconst processConfigFile = async (path) => {\n const lowerPath = path.toLowerCase()\n if (\n lowerPath.endsWith('.json')\n || lowerPath.endsWith('.yml')\n || lowerPath.endsWith('.yaml')\n ) {\n const contents = await readFile(path, { encoding : 'utf8' })\n const json = yaml.load(contents)\n\n return json\n }\n else {\n const config = await import(path)\n\n return config.default\n }\n}\n\nexport { processConfigFile }\n","import { readFile } from 'node:fs/promises'\n\nconst extractPatternsFromFile = async (path) => {\n const fileContents = await readFile(path, { encoding : 'utf8' })\n\n const filePatterns = fileContents\n .split(/(?:\\r)?\\n/) // one pattern per line\n .map((l) => l.trim()) // trim all lines\n .filter((l) => l.length > 0 && !l.startsWith('#')) // remove blank lines and comment lines\n\n return filePatterns\n}\n\nexport { extractPatternsFromFile }\n","import { extractPatternsFromFile } from './extract-patterns-from-file'\n\nconst processFilePatterns = async (filePatterns = [], filePaths = []) => {\n const patterns = [...filePatterns]\n\n const extractions = []\n for (const path of filePaths) {\n extractions.push(extractPatternsFromFile(path))\n }\n\n patterns.push(...(await Promise.all(extractions)).flat())\n\n return patterns\n}\n\nexport { processFilePatterns }\n","import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nimport { ArgumentInvalidError } from 'standard-error-set'\nimport { find } from 'find-plus'\n\nimport { allExts } from '../default-config/js-extensions'\nimport { processFilePatterns } from './process-file-patterns'\nimport { processGitignore } from './process-gitignore'\nimport { processPackageIgnores } from './process-package-ignores'\n\nconst selectFilesFromOptions = async ({\n files,\n filesPaths,\n ignoreFiles,\n ignoreFilesPaths,\n ignorePackageSettings,\n noStandardIgnores,\n root = process.cwd(),\n}) => {\n const standardIgnores = ['**/test/data/**/*', 'doc/**', 'dist/**']\n const allExtsMatch = `@(${allExts.join('|')})`\n\n const targetPatterns = await processFilePatterns(files, filesPaths)\n if (targetPatterns.length === 0) {\n const rootSrcIndicatorFiles = ['index.js', 'index.mjs', 'index.cjs']\n if (rootSrcIndicatorFiles.some((f) => existsSync(join(root, f)))) {\n targetPatterns.push(`**/*${allExtsMatch}`)\n }\n else if (existsSync(join(root, 'src'))) {\n targetPatterns.push(`src/**/*${allExtsMatch}`)\n }\n else {\n throw new ArgumentInvalidError({\n message :\n \"Did not find root index nor 'src' directory to indicate default matching pattern.\",\n hint : \"Specify '--files' or '--files-paths'.\",\n })\n }\n }\n\n const ignorePatterns = await processFilePatterns(\n ignoreFiles,\n ignoreFilesPaths\n )\n if (noStandardIgnores !== true) {\n ignorePatterns.push(...standardIgnores)\n ignorePatterns.push(...processGitignore({ warnOnNotIgnore : true }))\n }\n if (ignorePackageSettings !== true) {\n ignorePatterns.push(...(await processPackageIgnores()))\n }\n\n return await find({\n onlyFiles : true,\n root,\n paths : targetPatterns,\n excludePaths : ignorePatterns,\n })\n}\n\nexport { selectFilesFromOptions }\n","import gitIgnoreToGlob from 'gitignore-to-glob'\nimport { CommonError } from 'standard-error-set'\n\nconst processGitignore = ({ path = '.gitignore', warnOnNotIgnore }) => {\n try {\n const patterns = gitIgnoreToGlob(path)\n const checkNotIgnore =\n warnOnNotIgnore === true\n ? (pattern) => {\n if (pattern.charAt(0) !== '!') {\n process.stderr.write(\n `Negated '.gitignore' pattern '${pattern}' will be ignored.`\n )\n }\n }\n : (pattern) => {\n if (pattern.charAt(0) !== '!') {\n throw new CommonError({\n // TODO: Use ConditionsNotMetError when implemented\n message :\n \"'.gitignore' contains un-usable negative ignore pattern. These patterns are ignored.\",\n hint : \"Rewrite the '.gitignore' patterns to factor out the negative patterns.\",\n })\n }\n }\n patterns.some(checkNotIgnore)\n // we process these patters as ignore patterns, so we remove the '!', which flips the semantics\n const ignorePatterns = patterns\n .filter((p) => p.charAt(0) === '!')\n .map((p) => p.slice(1))\n\n return ignorePatterns\n }\n catch (e) {\n if (e.code !== 'NOENT') {\n throw e\n }\n\n return []\n }\n}\n\nexport { processGitignore }\n","import { readFile } from 'node:fs/promises'\n\nconst processPackageIgnores = async () => {\n const packageContents = await readFile('./package.json', { encoding : 'utf8' })\n const packageJSON = JSON.parse(packageContents)\n\n return packageJSON.devPkg?.linting?.ignores || []\n}\n\nexport { processPackageIgnores }\n","import commandLineArgs from 'command-line-args'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { cliSpec } from './cli-spec'\nimport { formatAndLint } from '../lib/format-and-lint'\nimport { getEslint } from '../lib/lib/get-eslint'\nimport { processConfigFile } from './lib/process-config-file'\nimport { selectFilesFromOptions } from '../lib/lib/select-files-from-options'\n\nconst fandl = async ({ argv = process.argv, stdout = process.stdout } = {}) => {\n const mainOpts = commandLineArgs(cliSpec.arguments, {\n argv,\n camelCase : true,\n partial : true,\n })\n const command = mainOpts.command || 'format-and-lint'\n\n if (command === 'format-and-lint' || command === 'lint') {\n const options = extractFormatOrLintOptions(command, mainOpts)\n\n const {\n // see 'selectFilesFromOptions' for additional options processed by fandl\n eslintConfigPath,\n eslintConfigComponentsPath,\n prettierConfigPath,\n ...remainderOptions\n } = options\n\n const check = command === 'lint'\n\n verifyArgs(options)\n\n const filePaths = await selectFilesFromOptions(remainderOptions)\n\n const eslintConfig =\n eslintConfigPath === undefined\n ? undefined\n : await processConfigFile(eslintConfigPath)\n\n const eslintComfigComponents =\n eslintConfigComponentsPath === undefined\n ? undefined\n : await processConfigFile(eslintConfigComponentsPath)\n\n const prettierConfig =\n prettierConfigPath === undefined\n ? undefined\n : await processConfigFile(prettierConfigPath)\n\n const eslint = getEslint({ check, eslintConfig, eslintComfigComponents })\n\n const { lintResults } = await formatAndLint({\n ...remainderOptions, // must come first; will commonly specify 'files'\n check,\n eslint,\n files : filePaths,\n prettierConfig,\n })\n\n // TODO: support '--color', '--no-color options; The formatter internally uses 'chalk', which auto-detects color\n // based on:\n // 1) '--color' or '--no-color' options on process.argv\n // 2) FORCE_COLOR env var\n // 3) output stream type\n const formatter = await eslint.loadFormatter('stylish')\n const resultText = formatter.format(lintResults)\n\n stdout.write(resultText)\n // if we had something to say, then that indicates an error/warning in the source\n if (resultText !== '') {\n process.exit(1) // eslint-disable-line no-process-exit\n }\n }\n}\n\nconst extractFormatOrLintOptions = (command, mainOpts) =>\n mainOpts._unknown === undefined\n ? mainOpts\n : Object.assign(\n {},\n mainOpts,\n commandLineArgs(\n cliSpec.commands.find((c) => c.name === command).arguments,\n { argv : mainOpts._unknown, camelCase : true }\n )\n )\n\nconst verifyArgs = ({ eslintConfigPath, eslintConfigComponentsPath }) => {\n if (\n eslintConfigPath !== undefined\n && eslintConfigComponentsPath !== undefined\n ) {\n throw new ArgumentInvalidError({\n message :\n \"Specifying both '--eslint-config-path' and '--eslint-config-components-path' is invalid. Please specify one or the other.\",\n })\n }\n}\n\nexport { fandl }\n","import { fandl } from './fandl'\n\nfandl()\n"],"names":["lintArgs","name","multiple","description","type","Boolean","cliSpec","arguments","defaultOption","default","commands","alias","descirption","linebreakTypes","linebreakTypesExcept","types","result","splice","indexOf","jsxExts","allExts","jsxExtsStr","join","allExtsStr","__dirname","dirname","fileURLToPath","url","babelConfigPathInstalled","babelConfigPathTest","babelConfigPath","existsSync","undefined","Error","packageContents","readFileSync","encoding","packageJSON","JSON","parse","dependencies","devDependencies","engines","node","standardPlugin","standardConfig","prettier","sortImports","jsx","react","typescript","reactSettings","version","stylisticConfig","stylistic","configs","plugins","Object","assign","standard","import","importPlugin","promise","promisePlugin","n","nPlugin","rules","js","recommended","align","afterColon","beforeColon","allowTemplateLiterals","avoidEscape","arrays","objects","imports","exports","functions","ArrayExpression","CallExpression","flatTernaryExpressions","FunctionDeclaration","body","parameters","FunctionExpression","ignoreComments","ignoredNodes","ImportDeclaration","MemberExpression","ObjectExpression","offsetTernaryExpressions","outerIIFEBody","SwitchCase","VariableDeclarator","max","overrides","blankLine","prev","next","anonymous","asyncArrow","named","after","before","varsIgnorePattern","yoda","eqeqeq","complexity","skipBlankLines","skipComments","indent","allFiles","defaultBaseConfig","files","languageOptions","parser","babelParser","parserOptions","sourceType","requireConfigFile","babelOptions","configFile","ecmaFeatures","ecmaVersion","settings","fixupPluginRules","nodePlugin","globals","globalsPkg","tryExtensions","defaultJsdocConfig","ignores","jsdoc","jsdocPlugin","definedTags","defaultJsxConfig","browser","defaultTestsConfig","jest","getEslint","check","eslintConfig","eslintConfigComponents","ArgumentInvalidError","message","getEslintConfig","additional","base","test","ESLint","fix","overrideConfigFile","overrideConfig","cwd","prettierConfig","arrowParens","bracketSpacing","semi","singleQuote","trailingComma","formatAndLint","async","defaultPrettierConfig","options","length","ArgumentMissingError","argumentName","argumentType","argumentValue","map","f","path","resolve","processOptions","eslint","prettierParseConfig","structuredClone","lintResults","Promise","all","file","processSource","flat","noWrite","outputDir","relativeStem","process","readPromise","readFile","inputSource","prettierSource","prettierFormat","lintText","filePath","output","formattedText","outputPath","startsWith","hint","relPath","slice","sep","mkdir","recursive","outputText","writeFile","processConfigFile","lowerPath","toLowerCase","endsWith","contents","yaml","load","extractPatternsFromFile","split","l","trim","filter","processFilePatterns","filePatterns","filePaths","patterns","extractions","push","selectFilesFromOptions","filesPaths","ignoreFiles","ignoreFilesPaths","ignorePackageSettings","noStandardIgnores","root","standardIgnores","allExtsMatch","targetPatterns","some","ignorePatterns","processGitignore","warnOnNotIgnore","gitIgnoreToGlob","checkNotIgnore","pattern","charAt","stderr","write","CommonError","p","e","code","devPkg","linting","processPackageIgnores","find","onlyFiles","paths","excludePaths","extractFormatOrLintOptions","command","mainOpts","_unknown","commandLineArgs","c","argv","camelCase","verifyArgs","eslintConfigPath","eslintConfigComponentsPath","stdout","partial","prettierConfigPath","remainderOptions","resultText","loadFormatter","format","exit","fandl"],"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O,IAA/B0O,SAEU3D,GAAkB2D;AAE9B,MAAM/G,OACmB3H,IAAvB6O,OACI7O,QACM+K,GAAkB8D,GAExB9F,EAASnC,GAAU,CAAEC,QAAOC,kBAE5BoC,YAAEA,SAAsBjB,GAAc,IACvC6G,EACHjI,QACAkC,SACA7D,MAAQ2G,EACRlE,mBASIoH,SADkBhG,EAAOiG,cAAc,YAChBC,OAAO/F;AAEpCyF,EAAOvB,MAAM2B,GAEM,KAAfA,GACFpF,QAAQuF,KAAK,EAEjB,GCtEFC"}
|
|
1
|
+
{"version":3,"file":"fandl-exec.js","sources":["../src/cli/cli-spec.mjs","../src/lib/default-config/lib/linebreak-types-except.mjs","../src/lib/default-config/js-extensions.mjs","../src/lib/default-config/eslint-config.mjs","../src/lib/lib/get-eslint.mjs","../src/lib/default-config/prettier.config.mjs","../src/lib/format-and-lint.mjs","../src/cli/lib/process-config-file.mjs","../src/lib/lib/extract-patterns-from-file.mjs","../src/lib/lib/process-file-patterns.mjs","../src/lib/lib/select-files-from-options.mjs","../src/lib/lib/process-gitignore.mjs","../src/lib/lib/process-package-ignores.mjs","../src/cli/fandl.mjs","../src/cli/index.mjs"],"sourcesContent":["const lintArgs = [\n {\n name : 'files',\n multiple : true,\n description :\n \"A file patterns selecting target files to process. If neither this nor '--files-paths' is specified, then standard, predefined patterns will be used.\",\n },\n {\n name : 'files-paths',\n multiple : true,\n description :\n \"A path to a file containing newline separated file patterns selecting files to process. If neither this nor '--files' is specified, then standard, predefined patterns will be used.\",\n },\n {\n name : 'ignore-files',\n multiple : true,\n description : 'A file pattern selecting files to ignore.',\n },\n {\n name : 'ignore-files-paths',\n multiple : true,\n description : 'A path to a file containing a list of newline separated file patterns selecting files to ignore.',\n },\n {\n name : 'eslint-config-path',\n description : 'Specifies the path to a eslint configuration file to replace the default base eslint configuration.',\n },\n {\n name : 'eslint-config-components-path',\n description :\n \"Specifies the path to a configuration file that resolves to an object keyed to 'base', 'jsx', 'node', and 'test' configuration components.\",\n },\n {\n name : 'ignore-package-settings',\n type : Boolean,\n description : \"Suppresses merging settings from 'package.json:devPkg.linting'.\",\n },\n {\n name : 'no-standard-ignores',\n type : Boolean,\n description : \"Suppresses default .gitignore and '**/test/data/**/*' ignore patterns.\",\n },\n {\n name : 'root',\n description : 'The directory from which to start looking for files.',\n },\n]\n\nconst cliSpec = {\n mainCommand : 'fandl',\n description : 'Optimized, single command out of the box JavaScript format and lint tool.',\n arguments : [\n {\n name : 'command',\n defaultOption : true,\n default : 'format-and-lint',\n description : 'The action to perform.',\n },\n ...lintArgs,\n ],\n commands : [\n {\n name : 'format-and-lint',\n description : 'Formats and runs lint checks on the target files.',\n arguments : [\n ...lintArgs,\n {\n name : 'output-dir',\n alias : 'o',\n description :\n \"The directory to output the formatted files. This suppresses the default behavior of updating files in place. Output files will be placed relative to the source file and the effective source stem. See '--relative-stem' for details. If for whatever reason there is a name collision, the process will exit in error.\",\n },\n {\n name : 'prettier-config-path',\n description :\n 'Specifies the path to a prettier configuration file to replace the default configuration as the base prettier configuration.',\n },\n {\n name : 'relative-stem',\n description :\n \"The relative stem determines the relative placement of output files when sending output to '--output-dir' (as opposed to the default 'update in place' behavior). E.g., Given input '/usr/foo/project/src/bar/baz.mjs', '--output-dir /tmp/foo', and '--relative-stem /usr/foo/project/src/', the output file will be written to '/tmp/foo/bar/baz.mjs'. By default, the relative stem is the working directory of the process, which can be changed/set manually with this option. If any resolved input file path does not start with the effective effective source stem, the process will exit with an error.\",\n },\n ],\n },\n {\n name : 'lint',\n descirption : 'Runs lint checks on the target files.',\n arguments : lintArgs,\n },\n /* { name: 'show-eslint-config', description: 'Prints the effective eslint configuration to stdout.', arguments: globalArguments },\n { name: 'show-prettier-config', description: 'Prints the effective prettier configuration to stdout.', arguments: globalArguments }, */\n {\n name : 'help',\n description : 'Prints the command help.',\n arguments : [\n {\n name : 'command',\n defaultOption : true,\n description : 'Optional command specific help.',\n },\n ],\n },\n { name : 'version', description : 'Prints the tool version.' },\n ],\n}\n\nexport { cliSpec }\n","const linebreakTypes = [\n 'block',\n 'block-like',\n 'break',\n 'case',\n 'cjs-export',\n 'cjs-import',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'directive',\n 'do',\n 'empty',\n 'export',\n 'expression',\n 'for',\n 'function',\n 'if',\n 'iife',\n 'import',\n 'let',\n 'multiline-block-like',\n 'multiline-const',\n 'multiline-expression',\n 'multiline-let',\n 'multiline-var',\n 'return',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'switch',\n 'throw',\n 'try',\n 'var',\n 'while',\n 'with',\n]\n\n/**\n * A helper function used to sanely build 'blankline' entries in the '@stylistic/padding-line-between-statements' rule.\n * Basically, what we often want is to say \"we want a blank line between expression type A and all other expression\n * except for B, C, and D.\" This is useful because the '@stylistic/padding-line-between-statements' rule requires you\n * specify each type where a blank line is required, but it's generally easier to specify a set of expression types for\n * which a blank line is _NOT_ required.E.g.:\n *\n * ```javascript\n * '@stylistic/padding-line-between-statements' : [\n * 'error',\n * { blankLine : 'always', prev : '*', next : 'class' },\n * {\n * blankLine : 'always',\n * prev : linebreakTypesExcept('cjs-export', 'export'),\n * next : 'export',\n * },\n * ]\n * ```\n *\n * Would require (and/or add) a blank line between a class declaration and anything else, and a blank line between\n * `import` statements and all other statements except `import` or `cjs-import` statements. That way, all your `import`\n * statements would be grouped together, but would have a blank line between the last `import` and whatever the next\n * non-import statement is.\n * @param {...string} types - A list of the types to exclude from the rule (meaning all other known types are included).\n * @returns {string[]} - An array of the non-excluded types.\n */\nconst linebreakTypesExcept = (...types) => {\n const result = [...linebreakTypes]\n for (const type of types) {\n result.splice(result.indexOf(type), 1)\n }\n\n return result\n}\n\nexport { linebreakTypesExcept }\n","export const stdExts = ['.js', '.cjs', '.mjs']\nexport const jsxExts = ['.jsx']\nexport const allExts = [...stdExts, ...jsxExts]\nexport const stdExtsStr = stdExts.join(',')\nexport const jsxExtsStr = jsxExts.join(',')\nexport const allExtsStr = allExts.join(',')\n","/**\n * @file ESLint configuration file implementing (almost) [Standard JS style]{@link https://standardjs.com/},\n * [ESLint recommended js rules]{@link https://eslint.org/docs/latest/rules/},\n * [jsdoc rules]{@link https://www.npmjs.com/package/eslint-plugin-jsdoc} and, when appropriate,\n * [recommended node]{@link https://www.npmjs.com/package/eslint-plugin-node} and\n * [react]{@link https://www.npmjs.com/package/eslint-plugin-react} rules as well.\n *\n * Our one exception to the standard style is implementing aligned colons on multiline\n * 'key-spacing'. We think it makes things more readable. We also add a preference for regex literals where possible.\n */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport globalsPkg from 'globals'\nimport importPlugin from 'eslint-plugin-import'\nimport jsdocPlugin from 'eslint-plugin-jsdoc'\nimport nodePlugin from 'eslint-plugin-node'\nimport promisePlugin from 'eslint-plugin-promise'\nimport nPlugin from 'eslint-plugin-n'\nimport babelParser from '@babel/eslint-parser'\nimport { fixupPluginRules } from '@eslint/compat'\nimport js from '@eslint/js'\nimport stylistic from '@stylistic/eslint-plugin'\nimport standardConfig from 'eslint-config-standard-kit'\n\nimport { linebreakTypesExcept } from './lib/linebreak-types-except'\nimport { allExts, allExtsStr, jsxExtsStr } from './js-extensions'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\nconst babelConfigPathInstalled = join(__dirname, 'babel', 'babel.config.cjs')\nconst babelConfigPathTest = join('dist', 'babel', 'babel.config.cjs')\n\nconst babelConfigPath =\n existsSync(babelConfigPathInstalled) === true\n ? babelConfigPathInstalled\n : existsSync(babelConfigPathTest)\n ? babelConfigPathTest\n : undefined\nif (babelConfigPath === undefined) {\n throw new Error('Could not find babel config file.')\n}\n\nconst packageContents = readFileSync('./package.json', { encoding : 'utf8' })\nconst packageJSON = JSON.parse(packageContents)\nconst { dependencies = {}, devDependencies = {}, engines = { node : true } } = packageJSON\n\nconst standardPlugin = standardConfig({\n prettier : true,\n sortImports : true,\n jsx : true,\n node : true,\n react : true,\n typescript : true,\n})\n\nconst usesReact = dependencies.react !== undefined || devDependencies.react !== undefined\nconst reactSettings = usesReact ? { version : 'detect' } : {}\n\nconst stylisticConfig = stylistic.configs['recommended-flat']\n\nconst plugins = Object.assign(\n {\n standard : standardPlugin,\n import : importPlugin,\n promise : promisePlugin,\n n : nPlugin,\n },\n stylisticConfig.plugins // this names the plugin '@stylistic'\n)\n\nconst rules = {\n ...js.configs.recommended.rules,\n ...standardPlugin.rules,\n ...stylisticConfig.rules, // the stylistic rules also cover react rules\n // override key spacing to get things aligned\n '@stylistic/key-spacing' : ['error', { align : 'colon', afterColon : true, beforeColon : true }],\n // override to allow avoiding escapes\n '@stylistic/quotes' : ['error', 'single', { allowTemplateLiterals : true, avoidEscape : true }],\n // additional rules\n '@stylistic/arrow-parens' : ['error', 'always'], // I like this to be consistent\n '@stylistic/array-bracket-newline' : ['error', 'consistent'],\n '@stylistic/array-element-newline' : ['error', 'consistent'],\n '@stylistic/comma-dangle' : [\n 'error',\n {\n arrays : 'always-multiline',\n objects : 'always-multiline',\n imports : 'never',\n exports : 'never',\n functions : 'never',\n },\n ],\n '@stylistic/function-call-argument-newline' : ['error', 'consistent'],\n '@stylistic/function-call-spacing' : ['error', 'never'],\n '@stylistic/function-paren-newline' : ['error', 'consistent'],\n '@stylistic/indent' : [\n 'error',\n 2,\n {\n ArrayExpression : 1,\n CallExpression : { arguments : 1 },\n flatTernaryExpressions : false,\n FunctionDeclaration : { body : 1, parameters : 1 },\n FunctionExpression : { body : 1, parameters : 1 },\n ignoreComments : false,\n ignoredNodes : [\n 'TSUnionType',\n 'TSIntersectionType',\n 'TSTypeParameterInstantiation',\n 'FunctionExpression > .params[decorators.length > 0]',\n 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',\n ],\n ImportDeclaration : 1,\n MemberExpression : 1,\n ObjectExpression : 1,\n offsetTernaryExpressions : true,\n outerIIFEBody : 1,\n SwitchCase : 1,\n VariableDeclarator : 4,\n },\n ],\n '@stylistic/linebreak-style' : ['error', 'unix'],\n // '@stylistic/indent-binary-ops': ['error', 4], // same as default, but since we define indent, these two go together\n '@stylistic/max-statements-per-line' : ['error', { max : 2 }], // allow for short one-liners\n // The default is just 'before'; but equals are special. IMO.\n '@stylistic/operator-linebreak' : ['error', 'before', { overrides : { '=' : 'after', '-=' : 'after', '+=' : 'after' } }],\n '@stylistic/padding-line-between-statements' : [\n 'error',\n { blankLine : 'always', prev : '*', next : 'class' },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'export',\n },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'cjs-export',\n },\n {\n blankLine : 'always',\n prev : 'import',\n next : linebreakTypesExcept('import'),\n },\n {\n blankLine : 'always',\n prev : 'cjs-import',\n // Because a cjs-import is actually many different things...\n next : linebreakTypesExcept(\n 'cjs-import',\n 'const',\n 'let',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'var'\n ),\n },\n { blankLine : 'always', prev : '*', next : 'return' },\n ],\n // prettier insists on putting required semi-colons first, which is probably the better answer since it's more\n // resilient to code changes\n '@stylistic/semi-style' : ['error', 'first'],\n // The @stylistic default of 'always' for all seems at odd with general standards, which don't have space before\n // named functions. I like that because when we invoke a function, you never see a space, and I see no reason to\n // write the declaration different.\n '@stylistic/space-before-function-paren' : ['error', { anonymous : 'always', asyncArrow : 'always', named : 'never' }],\n '@stylistic/switch-colon-spacing' : ['error', { after : true, before : false }],\n // one-true-brace-style /is/ the more common, but i just don't like it. I think Stroustrup is easier to read *and*,\n // most important, with 1tbs, you can't do these kind of comments:\n //\n // if { ...\n // } // I really like to be able to put comments here\n // else if (some really conditional that means we'd have to put our comment inside the else-if!) {...}\n //\n // and I do those kind of comments sometime.\n // 'standard/brace-style' : ['errer', 'stroustrup', { allowSingleLine: true }],\n // TODO; looks like it's failing on the `export * from './foo'` statements; even though we have the babel pluggin`\n 'import/export' : 'off',\n 'import/extensions' : [\n 'error', // or 'warn'\n 'never', // Default: disallow all extensions\n {\n svg : 'always', // Override: always allow .svg extension\n },\n ],\n // the standard 'no-unused-vars ignores unused args, which we'd rather catch. We also want to exclude 'React',\n // which we need to import for react to work, even when not used\n 'no-unused-vars' : ['error', { varsIgnorePattern : 'React' }],\n // style/consistency rules\n // this modifies JS Standard style\n 'prefer-regex-literals' : 'error',\n 'yoda' : ['error', 'never'],\n // use 'process.stdout'/'process.stderr' when you really want to communicate to the user\n 'no-console' : 'error',\n // efficiency rules\n 'no-await-in-loop' : 'error',\n // rules for odd code/possible red flags/unintentional logic\n 'no-lonely-if' : 'error',\n 'no-return-assign' : 'error',\n 'no-shadow' : 'error',\n 'no-extra-label' : 'error',\n 'no-label-var' : 'error',\n 'no-invalid-this' : 'error',\n 'no-unreachable-loop' : 'error',\n 'no-extra-bind' : 'error',\n 'require-await' : 'error',\n 'consistent-return' : 'error',\n 'default-case-last' : 'error',\n 'eqeqeq' : 'error',\n // limit code complexity\n 'complexity' : ['error', 20], // default val\n 'max-depth' : ['error', 4], // default val\n 'max-lines' : ['error', { max : 300, skipBlankLines : true, skipComments : true }], // default val,\n 'max-lines-per-function' : ['error', { max : 50, skipBlankLines : true, skipComments : true }],\n}\n\n// OK, so the standard plugin provides lots of nice rules, but there are some conflicts, so we delete them (and let the\n// @stylistic rules control).\ndelete rules['block-spacing'] // redundant with @stylistic\ndelete rules['brace-style'] // they want 1tbs, we want stroustrup\ndelete rules['comma-dangle'] // they so no, we say multiline\ndelete rules['eol-last'] // redundant with @stylistic\ndelete rules.indent\ndelete rules['indent-binary-ops']\ndelete rules['key-spacing'] // redundant with @stylistic\ndelete rules['operator-linebreak'] // they say after, we say before\ndelete rules['no-trailing-spaces'] // doesn't conflict, but it's redundant with @stylistic\ndelete rules['space-before-function-paren'] // we override default and redundant anyway\ndelete rules['@stylistic/indent-binary-ops'] // this is handled better by prettier\n// deprecated rules\ndelete rules['quote-props']\n\nconst allFiles = [`**/*{${allExtsStr}}`]\n\nconst defaultBaseConfig = {\n files : allFiles,\n languageOptions : {\n parser : babelParser,\n parserOptions : {\n sourceType : 'module',\n requireConfigFile : true,\n babelOptions : { configFile : babelConfigPath },\n ecmaFeatures : { jsx : true },\n },\n ecmaVersion : 'latest',\n },\n settings : { react : reactSettings },\n plugins,\n rules,\n}\n\nif (engines?.node !== undefined) {\n defaultBaseConfig.plugins.node = fixupPluginRules(nodePlugin)\n // TODO: actually, we don't want this for MJS files... but I'm not sure what we do want\n defaultBaseConfig.languageOptions.globals = globalsPkg.node\n Object.assign(defaultBaseConfig.rules, {\n ...nodePlugin.configs.recommended.rules,\n 'node/no-unsupported-features/es-syntax' : 'off', // we expect teh code to run through Babel, so it's fine\n 'node/prefer-promises/dns' : 'error',\n 'node/prefer-promises/fs' : 'error',\n 'node/no-missing-import' : [\n 'error',\n {\n tryExtensions : allExts,\n },\n ],\n })\n}\n\nconst defaultJsdocConfig = {\n files : allFiles,\n ignores : [`**/index{${allExtsStr}}`, '**/__tests__/**/*', '**/*.test.*'],\n plugins : { jsdoc : jsdocPlugin },\n rules : {\n ...jsdocPlugin.configs['flat/recommended-error'].rules,\n 'jsdoc/require-description' : 'error',\n // there is some indication that jsdoc should be able to divine default from ES6 default parameter settings (\n // e.g., func(foo = true)), but if this is possible, it's not working for us. (Prior to 2025)\n 'jsdoc/no-defaults' : 'off',\n // allow the dmd-readme-api plugin to define the 'category' tag\n 'jsdoc/check-tag-names' : ['error', { definedTags : ['category'] }],\n },\n}\n\nconst defaultJsxConfig = {\n files : [`**/*{${jsxExtsStr}}`],\n // add necessary globals when processing JSX files\n languageOptions : { globals : globalsPkg.browser },\n}\n\nconst defaultTestsConfig = {\n files : ['**/_tests_/**', `**/*.test{${allExtsStr}}`],\n // adds correct globals when processing jest tests\n languageOptions : { globals : globalsPkg.jest },\n rules : {\n // override default check for tests; Jest 'describe' functions can get very long, and that's OK\n 'max-lines-per-function' : 'off',\n 'max-lines' : ['error', { max : 500, skipBlankLines : true, skipComments : true }],\n },\n}\n\nconst getEslintConfig = ({\n additional = {},\n base = defaultBaseConfig,\n jsdoc = defaultJsdocConfig,\n jsx = defaultJsxConfig,\n test = defaultTestsConfig,\n} = {}) => {\n const eslintConfig = [base, jsdoc, jsx, test, additional]\n\n return eslintConfig\n}\n\nexport { getEslintConfig }\n","import { ESLint } from 'eslint'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { getEslintConfig } from '../default-config/eslint-config'\n\nconst getEslint = ({ check, eslintConfig, eslintConfigComponents }) => {\n if (eslintConfig !== undefined && eslintConfigComponents !== undefined) {\n throw new ArgumentInvalidError({\n message : \"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously.\",\n })\n }\n\n if (eslintConfig === undefined) {\n eslintConfig = getEslintConfig(eslintConfigComponents)\n }\n\n return new ESLint({\n fix : check === false,\n // this keeps eslint from insisting on an eslint config file\n overrideConfigFile : true,\n overrideConfig : eslintConfig,\n // This isn't necessary right now, but logically, it makes more sense. The difference is whether eslint looks for\n // config files relative to the base path (see below) or the file itself. In future, if/when we support config\n // override/augmentation, it makes sense to do it relative to the file, I think.\n // flags: ['unstable_config_lookup_from_file'],\n // By default, eslint sets the 'base path' to the CWD of the process and if the linted file isn't under the 'base\n // path', it is ignored. However, we expect either absolute file paths (from 'formatAndLint') or create absolute\n // file paths ourselves (from fandl CLI), so we set 'cwd' to '/' so no files are reject on that basis.\n cwd : '/',\n })\n}\n\nexport { getEslint }\n","const prettierConfig = {\n arrowParens : 'always',\n bracketSpacing : true,\n printWidth : 120,\n semi : false,\n singleQuote : true,\n trailingComma : 'es5',\n}\n\nexport { prettierConfig }\n","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport * as path from 'node:path'\n\nimport { format as prettierFormat } from 'prettier'\nimport { ArgumentInvalidError, ArgumentMissingError } from 'standard-error-set'\n\nimport { getEslint } from './lib/get-eslint'\nimport { prettierConfig as defaultPrettierConfig } from './default-config/prettier.config'\n\n/**\n * Parses, lints, and (when `check` is false) reformats the `files` text. By default, this function will update the\n * `files` in-place.\n * @param {object} options - The input options.\n * @param {boolean} [options.check = false] - If `true` then the files are linted, but not reformatted.\n * @param {boolean} [options.noWrite = false] - If `true`, then the files are not updated in placed. Has no effect when\n * `check = false`, but when combined with `check = true`, means that the text is reformatted and attached to the\n * `LintResult`s, but the files themselves are not updated. You can access reformatted text as part of the\n * `result.lintResults[0].output`. Unlike results directly from `ESLint`, `output` is\n * always present on the `LintResult` object (rather than only being set if the text is changed.\n * @param {object} [options.eslintConfig = <default eslint config>] - A flat (9.x) style array of [eslint configuration\n * object](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects) to be used in\n * place of the default, out of the box configuration. This may not be specified along with `eslintConfigComponents`.\n * @param {object} [options.eslintConfigComponents = undefined] - An object with zero or more keys corresponding to the\n * `base`, `jsdoc`, `jsx`, `test`, or `additional` as discussed in the [component based\n * configuration](#component-based-configuration). This may not be specified along with `eslintConfig`.\n * @param {object} [options.prettierConfig = <default prettier config>] - A prettier [options\n * object](https://prettier.io/docs/en/options).\n * @param {object} [options.eslint = undefined] - A pre-configured\n * [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class) instance. If this is defined, then\n * `eslintConfig` and `eslintConfigComponents` will be ignored.\n * @param {string} [options.outputDir = undefined] - If provided, then output files (whether reformatted or not) will be\n * written to the specified directory relative to their location in the source. With `src/index.mjs` =>\n * `<outputDir>/src/index.mjs`, `src/foo/bar.mjs` => `<outputDir>/src/foo/bar.mjs`. This option has no effect if\n * `check = true` or `noWrite = true`. The relative starting point is controlled with the `relativeStem` option.\n * @param {string} [options.relativeStem = process.cwd()] - Controls the starting point for determining the relative\n * position of files when emitting to `outputDir` rather than updating in place. Impossible stems will result in an\n * error. E.g., given file `src/index.mjs`, `relativeStem = 'src/foo'` is invalid.\n * @returns {Promise<{eslint: object, lintResults: object[]}>} Resolves to an object with two fields. `eslint` points\n * to the an instance of [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class). `lintResults`\n * points to an array of [`LintResult`](https://eslint.org/docs/latest/integrate/nodejs-api#-lintresult-type)s.\n */\nconst formatAndLint = async (options) => {\n const {\n // see 'processSource' for additional options\n check = false,\n eslintConfig,\n eslintConfigComponents,\n prettierConfig = defaultPrettierConfig,\n } = options\n\n if (options.files === undefined || options.files.length === 0) {\n throw new ArgumentMissingError({\n argumentName : 'files',\n argumentType : 'string[]',\n argumentValue : options.files,\n })\n }\n\n // make files absolute\n const files = options.files.map((f) => path.resolve(f))\n\n const processOptions = Object.assign({}, options)\n\n if (processOptions.eslint === undefined) {\n processOptions.eslint = getEslint({\n check,\n eslintConfig,\n eslintConfigComponents,\n })\n }\n\n const prettierParseConfig = structuredClone(prettierConfig)\n prettierParseConfig.parser = 'babel'\n processOptions.prettierConfig = prettierParseConfig\n\n const lintResults = (await Promise.all(files.map((file) => processSource(file, processOptions)))).flat()\n\n return { eslint : processOptions.eslint, lintResults }\n}\n\nconst processSource = async (\n file,\n { check = false, eslint, noWrite = false, outputDir, prettierConfig, relativeStem = process.cwd() }\n) => {\n const readPromise = readFile(file, { encoding : 'utf8' })\n const inputSource = await readPromise\n const prettierSource = check === true ? inputSource : await prettierFormat(inputSource, prettierConfig)\n const lintResults = await eslint.lintText(\n // we must specify the file path in order for the proper rules from the flat config to attach\n prettierSource,\n { filePath : file }\n )\n\n // the output is undefined if there are no changes due to the linting, but there may be changes due to prettier, so\n // to keep the ultimate result consistent, we have to update output if prettier did something\n if (lintResults[0].output === undefined && prettierSource !== inputSource) {\n lintResults[0].output = prettierSource\n }\n const formattedText = lintResults[0].output\n\n if (check !== true && noWrite !== true && (formattedText !== undefined || outputDir !== undefined)) {\n let outputPath = file\n if (outputDir !== undefined) {\n if (!file.startsWith(outputPath)) {\n throw new ArgumentInvalidError({\n message : `Resolved input file path '${file}' does not start with effective source stem '${relativeStem}'.`,\n hint : \"Check input file paths/selection patterns and set or harmonize '--relative-stem' option if necessary.\",\n })\n }\n\n let relPath = file.slice(relativeStem.length)\n if (relPath.startsWith(path.sep)) {\n relPath = relPath.slice(1)\n }\n outputPath = path.join(outputDir, relPath)\n\n await mkdir(path.dirname(outputPath), { recursive : true })\n }\n\n const outputText = formattedText || prettierSource\n await writeFile(outputPath, outputText, { encoding : 'utf8' })\n }\n\n return lintResults\n}\n\nexport { formatAndLint }\n","import { readFile } from 'node:fs/promises'\n\nimport yaml from 'js-yaml'\n\nconst processConfigFile = async (path) => {\n const lowerPath = path.toLowerCase()\n if (lowerPath.endsWith('.json') || lowerPath.endsWith('.yml') || lowerPath.endsWith('.yaml')) {\n const contents = await readFile(path, { encoding : 'utf8' })\n const json = yaml.load(contents)\n\n return json\n }\n else {\n const config = await import(path)\n\n return config.default\n }\n}\n\nexport { processConfigFile }\n","import { readFile } from 'node:fs/promises'\n\nconst extractPatternsFromFile = async (path) => {\n const fileContents = await readFile(path, { encoding : 'utf8' })\n\n const filePatterns = fileContents\n .split(/(?:\\r)?\\n/) // one pattern per line\n .map((l) => l.trim()) // trim all lines\n .filter((l) => l.length > 0 && !l.startsWith('#')) // remove blank lines and comment lines\n\n return filePatterns\n}\n\nexport { extractPatternsFromFile }\n","import { extractPatternsFromFile } from './extract-patterns-from-file'\n\nconst processFilePatterns = async (filePatterns = [], filePaths = []) => {\n const patterns = [...filePatterns]\n\n const extractions = []\n for (const path of filePaths) {\n extractions.push(extractPatternsFromFile(path))\n }\n\n patterns.push(...(await Promise.all(extractions)).flat())\n\n return patterns\n}\n\nexport { processFilePatterns }\n","import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nimport { ArgumentInvalidError } from 'standard-error-set'\nimport { find } from 'find-plus'\n\nimport { allExts } from '../default-config/js-extensions'\nimport { processFilePatterns } from './process-file-patterns'\nimport { processGitignore } from './process-gitignore'\nimport { processPackageIgnores } from './process-package-ignores'\n\nconst selectFilesFromOptions = async ({\n files,\n filesPaths,\n ignoreFiles,\n ignoreFilesPaths,\n ignorePackageSettings,\n noStandardIgnores,\n root = process.cwd(),\n}) => {\n const standardIgnores = ['**/test/data/**/*', 'doc/**', 'dist/**']\n const allExtsMatch = `@(${allExts.join('|')})`\n\n const targetPatterns = await processFilePatterns(files, filesPaths)\n if (targetPatterns.length === 0) {\n const rootSrcIndicatorFiles = ['index.js', 'index.mjs', 'index.cjs']\n if (rootSrcIndicatorFiles.some((f) => existsSync(join(root, f)))) {\n targetPatterns.push(`**/*${allExtsMatch}`)\n }\n else if (existsSync(join(root, 'src'))) {\n targetPatterns.push(`src/**/*${allExtsMatch}`)\n }\n else {\n throw new ArgumentInvalidError({\n message : \"Did not find root index nor 'src' directory to indicate default matching pattern.\",\n hint : \"Specify '--files' or '--files-paths'.\",\n })\n }\n }\n\n const ignorePatterns = await processFilePatterns(ignoreFiles, ignoreFilesPaths)\n if (noStandardIgnores !== true) {\n ignorePatterns.push(...standardIgnores)\n ignorePatterns.push(...processGitignore({ warnOnNotIgnore : true }))\n }\n if (ignorePackageSettings !== true) {\n ignorePatterns.push(...(await processPackageIgnores()))\n }\n\n return await find({\n onlyFiles : true,\n root,\n paths : targetPatterns,\n excludePaths : ignorePatterns,\n })\n}\n\nexport { selectFilesFromOptions }\n","import gitIgnoreToGlob from 'gitignore-to-glob'\nimport { CommonError } from 'standard-error-set'\n\nconst processGitignore = ({ path = '.gitignore', warnOnNotIgnore }) => {\n try {\n const patterns = gitIgnoreToGlob(path)\n const checkNotIgnore =\n warnOnNotIgnore === true\n ? (pattern) => {\n if (pattern.charAt(0) !== '!') {\n process.stderr.write(`Negated '.gitignore' pattern '${pattern}' will be ignored.`)\n }\n }\n : (pattern) => {\n if (pattern.charAt(0) !== '!') {\n throw new CommonError({\n // TODO: Use ConditionsNotMetError when implemented\n message : \"'.gitignore' contains un-usable negative ignore pattern. These patterns are ignored.\",\n hint : \"Rewrite the '.gitignore' patterns to factor out the negative patterns.\",\n })\n }\n }\n patterns.some(checkNotIgnore)\n // we process these patters as ignore patterns, so we remove the '!', which flips the semantics\n const ignorePatterns = patterns.filter((p) => p.charAt(0) === '!').map((p) => p.slice(1))\n\n return ignorePatterns\n }\n catch (e) {\n if (e.code !== 'NOENT') {\n throw e\n }\n\n return []\n }\n}\n\nexport { processGitignore }\n","import { readFile } from 'node:fs/promises'\n\nconst processPackageIgnores = async () => {\n const packageContents = await readFile('./package.json', { encoding : 'utf8' })\n const packageJSON = JSON.parse(packageContents)\n\n return packageJSON.devPkg?.linting?.ignores || []\n}\n\nexport { processPackageIgnores }\n","import commandLineArgs from 'command-line-args'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { cliSpec } from './cli-spec'\nimport { formatAndLint } from '../lib/format-and-lint'\nimport { getEslint } from '../lib/lib/get-eslint'\nimport { processConfigFile } from './lib/process-config-file'\nimport { selectFilesFromOptions } from '../lib/lib/select-files-from-options'\n\nconst fandl = async ({ argv = process.argv, stdout = process.stdout } = {}) => {\n const mainOpts = commandLineArgs(cliSpec.arguments, {\n argv,\n camelCase : true,\n partial : true,\n })\n const command = mainOpts.command || 'format-and-lint'\n\n if (command === 'format-and-lint' || command === 'lint') {\n const options = extractFormatOrLintOptions(command, mainOpts)\n\n const {\n // see 'selectFilesFromOptions' for additional options processed by fandl\n eslintConfigPath,\n eslintConfigComponentsPath,\n prettierConfigPath,\n ...remainderOptions\n } = options\n\n const check = command === 'lint'\n\n verifyArgs(options)\n\n const filePaths = await selectFilesFromOptions(remainderOptions)\n\n const eslintConfig = eslintConfigPath === undefined ? undefined : await processConfigFile(eslintConfigPath)\n\n const eslintComfigComponents =\n eslintConfigComponentsPath === undefined ? undefined : await processConfigFile(eslintConfigComponentsPath)\n\n const prettierConfig = prettierConfigPath === undefined ? undefined : await processConfigFile(prettierConfigPath)\n\n const eslint = getEslint({ check, eslintConfig, eslintComfigComponents })\n\n const { lintResults } = await formatAndLint({\n ...remainderOptions, // must come first; will commonly specify 'files'\n check,\n eslint,\n files : filePaths,\n prettierConfig,\n })\n\n // TODO: support '--color', '--no-color options; The formatter internally uses 'chalk', which auto-detects color\n // based on:\n // 1) '--color' or '--no-color' options on process.argv\n // 2) FORCE_COLOR env var\n // 3) output stream type\n const formatter = await eslint.loadFormatter('stylish')\n const resultText = formatter.format(lintResults)\n\n stdout.write(resultText)\n // if we had something to say, then that indicates an error/warning in the source\n if (resultText !== '') {\n process.exit(1) // eslint-disable-line no-process-exit\n }\n }\n}\n\nconst extractFormatOrLintOptions = (command, mainOpts) =>\n mainOpts._unknown === undefined\n ? mainOpts\n : Object.assign(\n {},\n mainOpts,\n commandLineArgs(cliSpec.commands.find((c) => c.name === command).arguments, {\n argv : mainOpts._unknown,\n camelCase : true,\n })\n )\n\nconst verifyArgs = ({ eslintConfigPath, eslintConfigComponentsPath }) => {\n if (eslintConfigPath !== undefined && eslintConfigComponentsPath !== undefined) {\n throw new ArgumentInvalidError({\n message :\n \"Specifying both '--eslint-config-path' and '--eslint-config-components-path' is invalid. Please specify one or the other.\",\n })\n }\n}\n\nexport { fandl }\n","import { fandl } from './fandl'\n\nfandl()\n"],"names":["lintArgs","name","multiple","description","type","Boolean","cliSpec","arguments","defaultOption","default","commands","alias","descirption","linebreakTypes","linebreakTypesExcept","types","result","splice","indexOf","jsxExts","allExts","jsxExtsStr","join","allExtsStr","__dirname","dirname","fileURLToPath","url","babelConfigPathInstalled","babelConfigPathTest","babelConfigPath","existsSync","undefined","Error","packageContents","readFileSync","encoding","packageJSON","JSON","parse","dependencies","devDependencies","engines","node","standardPlugin","standardConfig","prettier","sortImports","jsx","react","typescript","reactSettings","version","stylisticConfig","stylistic","configs","plugins","Object","assign","standard","import","importPlugin","promise","promisePlugin","n","nPlugin","rules","js","recommended","align","afterColon","beforeColon","allowTemplateLiterals","avoidEscape","arrays","objects","imports","exports","functions","ArrayExpression","CallExpression","flatTernaryExpressions","FunctionDeclaration","body","parameters","FunctionExpression","ignoreComments","ignoredNodes","ImportDeclaration","MemberExpression","ObjectExpression","offsetTernaryExpressions","outerIIFEBody","SwitchCase","VariableDeclarator","max","overrides","blankLine","prev","next","anonymous","asyncArrow","named","after","before","svg","varsIgnorePattern","yoda","eqeqeq","complexity","skipBlankLines","skipComments","indent","allFiles","defaultBaseConfig","files","languageOptions","parser","babelParser","parserOptions","sourceType","requireConfigFile","babelOptions","configFile","ecmaFeatures","ecmaVersion","settings","fixupPluginRules","nodePlugin","globals","globalsPkg","tryExtensions","defaultJsdocConfig","ignores","jsdoc","jsdocPlugin","definedTags","defaultJsxConfig","browser","defaultTestsConfig","jest","getEslint","check","eslintConfig","eslintConfigComponents","ArgumentInvalidError","message","getEslintConfig","additional","base","test","ESLint","fix","overrideConfigFile","overrideConfig","cwd","prettierConfig","arrowParens","bracketSpacing","printWidth","semi","singleQuote","trailingComma","formatAndLint","async","defaultPrettierConfig","options","length","ArgumentMissingError","argumentName","argumentType","argumentValue","map","f","path","resolve","processOptions","eslint","prettierParseConfig","structuredClone","lintResults","Promise","all","file","processSource","flat","noWrite","outputDir","relativeStem","process","readPromise","readFile","inputSource","prettierSource","prettierFormat","lintText","filePath","output","formattedText","outputPath","startsWith","hint","relPath","slice","sep","mkdir","recursive","outputText","writeFile","processConfigFile","lowerPath","toLowerCase","endsWith","contents","yaml","load","extractPatternsFromFile","split","l","trim","filter","processFilePatterns","filePatterns","filePaths","patterns","extractions","push","selectFilesFromOptions","filesPaths","ignoreFiles","ignoreFilesPaths","ignorePackageSettings","noStandardIgnores","root","standardIgnores","allExtsMatch","targetPatterns","some","ignorePatterns","processGitignore","warnOnNotIgnore","gitIgnoreToGlob","checkNotIgnore","pattern","charAt","stderr","write","CommonError","p","e","code","devPkg","linting","processPackageIgnores","find","onlyFiles","paths","excludePaths","extractFormatOrLintOptions","command","mainOpts","_unknown","commandLineArgs","c","argv","camelCase","verifyArgs","eslintConfigPath","eslintConfigComponentsPath","stdout","partial","prettierConfigPath","remainderOptions","resultText","loadFormatter","format","exit","fandl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAMA,EAAW,CACf,CACEC,KAAW,QACXC,UAAW,EACXC,YACE,yJAEJ,CACEF,KAAW,cACXC,UAAW,EACXC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AAkBI,GAAuB6C,GAEzCjI,OAAoC/G,IAArB2O,OAAiC3O,QAAkBiL,GAAkB0D;KAGzD3O,IAA/B4O,SAA6D3D,GAAkB2D;AAEjF,MAAMhH,OAAwC5H,IAAvB+O,OAAmC/O,QAAkBiL,GAAkB8D,GAExF9F,EAASpC,GAAU,CAAEC,QAAOC,kBAE5BqC,YAAEA,SAAsBjB,GAAc,IACvC6G,EACHlI,QACAmC,SACA9D,MAAQ4G,EACRnE,mBASIqH,SADkBhG,EAAOiG,cAAc,YAChBC,OAAO/F;AAEpCyF,EAAOvB,MAAM2B,GAEM,KAAfA,GACFpF,QAAQuF,KAAK,EAEjB,GC9DFC"}
|
package/dist/fandl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{readFile as e,mkdir as r,writeFile as t}from"node:fs/promises"
|
|
2
2
|
import*as n from"node:path"
|
|
3
|
-
import{dirname as
|
|
3
|
+
import{dirname as i,join as o}from"node:path"
|
|
4
4
|
import{format as s}from"prettier"
|
|
5
5
|
import{ArgumentInvalidError as a,ArgumentMissingError as l}from"standard-error-set"
|
|
6
6
|
import{ESLint as c}from"eslint"
|
|
@@ -12,34 +12,34 @@ import g from"eslint-plugin-jsdoc"
|
|
|
12
12
|
import y from"eslint-plugin-node"
|
|
13
13
|
import b from"eslint-plugin-promise"
|
|
14
14
|
import x from"eslint-plugin-n"
|
|
15
|
-
import
|
|
16
|
-
import{fixupPluginRules as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
15
|
+
import v from"@babel/eslint-parser"
|
|
16
|
+
import{fixupPluginRules as w}from"@eslint/compat"
|
|
17
|
+
import k from"@eslint/js"
|
|
18
|
+
import h from"@stylistic/eslint-plugin"
|
|
19
19
|
import j from"eslint-config-standard-kit"
|
|
20
20
|
const C=["block","block-like","break","case","cjs-export","cjs-import","class","const","continue","debugger","default","directive","do","empty","export","expression","for","function","if","iife","import","let","multiline-block-like","multiline-const","multiline-expression","multiline-let","multiline-var","return","singleline-const","singleline-let","singleline-var","switch","throw","try","var","while","with"],E=(...e)=>{const r=[...C]
|
|
21
21
|
for(const t of e)r.splice(r.indexOf(t),1)
|
|
22
|
-
return r},T=[".jsx"],O=[".js",".cjs",".mjs",...T],
|
|
22
|
+
return r},T=[".jsx"],O=[".js",".cjs",".mjs",...T],L=T.join(","),F=O.join(","),q=o(i(d(import.meta.url)),"babel","babel.config.cjs"),I=o("dist","babel","babel.config.cjs"),S=!0===p(q)?q:p(I)?I:void 0
|
|
23
23
|
if(void 0===S)throw new Error("Could not find babel config file.")
|
|
24
|
-
const D=m("./package.json",{encoding:"utf8"}),$=JSON.parse(D),{dependencies:_={},devDependencies:P={},engines:B={node:!0}}=$,
|
|
24
|
+
const D=m("./package.json",{encoding:"utf8"}),$=JSON.parse(D),{dependencies:_={},devDependencies:P={},engines:B={node:!0}}=$,W=j({prettier:!0,sortImports:!0,jsx:!0,node:!0,react:!0,typescript:!0}),N=void 0!==_.react||void 0!==P.react?{version:"detect"}:{},R=h.configs["recommended-flat"],V=Object.assign({standard:W,import:u,promise:b,n:x},R.plugins),A={...k.configs.recommended.rules,...W.rules,...R.rules,"@stylistic/key-spacing":["error",{align:"colon",afterColon:!0,beforeColon:!0}],"@stylistic/quotes":["error","single",{allowTemplateLiterals:!0,avoidEscape:!0}],"@stylistic/arrow-parens":["error","always"],"@stylistic/array-bracket-newline":["error","consistent"],"@stylistic/array-element-newline":["error","consistent"],"@stylistic/comma-dangle":["error",{arrays:"always-multiline",objects:"always-multiline",imports:"never",exports:"never",functions:"never"}],"@stylistic/function-call-argument-newline":["error","consistent"],"@stylistic/function-call-spacing":["error","never"],"@stylistic/function-paren-newline":["error","consistent"],"@stylistic/indent":["error",2,{ArrayExpression:1,CallExpression:{arguments:1},flatTernaryExpressions:!1,FunctionDeclaration:{body:1,parameters:1},FunctionExpression:{body:1,parameters:1},ignoreComments:!1,ignoredNodes:["TSUnionType","TSIntersectionType","TSTypeParameterInstantiation","FunctionExpression > .params[decorators.length > 0]","FunctionExpression > .params > :matches(Decorator, :not(:first-child))"],ImportDeclaration:1,MemberExpression:1,ObjectExpression:1,offsetTernaryExpressions:!0,outerIIFEBody:1,SwitchCase:1,VariableDeclarator:4}],"@stylistic/linebreak-style":["error","unix"],"@stylistic/max-statements-per-line":["error",{max:2}],"@stylistic/operator-linebreak":["error","before",{overrides:{"=":"after","-=":"after","+=":"after"}}],"@stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"class"},{blankLine:"always",prev:E("cjs-export","export"),next:"export"},{blankLine:"always",prev:E("cjs-export","export"),next:"cjs-export"},{blankLine:"always",prev:"import",next:E("import")},{blankLine:"always",prev:"cjs-import",next:E("cjs-import","const","let","singleline-const","singleline-let","singleline-var","var")},{blankLine:"always",prev:"*",next:"return"}],"@stylistic/semi-style":["error","first"],"@stylistic/space-before-function-paren":["error",{anonymous:"always",asyncArrow:"always",named:"never"}],"@stylistic/switch-colon-spacing":["error",{after:!0,before:!1}],"import/export":"off","import/extensions":["error","never",{svg:"always"}],"no-unused-vars":["error",{varsIgnorePattern:"React"}],"prefer-regex-literals":"error",yoda:["error","never"],"no-console":"error","no-await-in-loop":"error","no-lonely-if":"error","no-return-assign":"error","no-shadow":"error","no-extra-label":"error","no-label-var":"error","no-invalid-this":"error","no-unreachable-loop":"error","no-extra-bind":"error","require-await":"error","consistent-return":"error","default-case-last":"error",eqeqeq:"error",complexity:["error",20],"max-depth":["error",4],"max-lines":["error",{max:300,skipBlankLines:!0,skipComments:!0}],"max-lines-per-function":["error",{max:50,skipBlankLines:!0,skipComments:!0}]}
|
|
25
25
|
delete A["block-spacing"],delete A["brace-style"],delete A["comma-dangle"],delete A["eol-last"],delete A.indent,delete A["indent-binary-ops"],delete A["key-spacing"],delete A["operator-linebreak"],delete A["no-trailing-spaces"],delete A["space-before-function-paren"],delete A["@stylistic/indent-binary-ops"],delete A["quote-props"]
|
|
26
|
-
const z=[`**/*{${
|
|
27
|
-
void 0!==B?.node&&(J.plugins.node=
|
|
28
|
-
const M={files:z,ignores:[`**/index{${
|
|
29
|
-
return void 0===r&&(r=(({additional:e={},base:r=J,jsdoc:t=M,jsx:n=Q,test:
|
|
26
|
+
const z=[`**/*{${F}}`],J={files:z,languageOptions:{parser:v,parserOptions:{sourceType:"module",requireConfigFile:!0,babelOptions:{configFile:S},ecmaFeatures:{jsx:!0}},ecmaVersion:"latest"},settings:{react:N},plugins:V,rules:A}
|
|
27
|
+
void 0!==B?.node&&(J.plugins.node=w(y),J.languageOptions.globals=f.node,Object.assign(J.rules,{...y.configs.recommended.rules,"node/no-unsupported-features/es-syntax":"off","node/prefer-promises/dns":"error","node/prefer-promises/fs":"error","node/no-missing-import":["error",{tryExtensions:O}]}))
|
|
28
|
+
const M={files:z,ignores:[`**/index{${F}}`,"**/__tests__/**/*","**/*.test.*"],plugins:{jsdoc:g},rules:{...g.configs["flat/recommended-error"].rules,"jsdoc/require-description":"error","jsdoc/no-defaults":"off","jsdoc/check-tag-names":["error",{definedTags:["category"]}]}},Q={files:[`**/*{${L}}`],languageOptions:{globals:f.browser}},U={files:["**/_tests_/**",`**/*.test{${F}}`],languageOptions:{globals:f.jest},rules:{"max-lines-per-function":"off","max-lines":["error",{max:500,skipBlankLines:!0,skipComments:!0}]}},Y=({check:e,eslintConfig:r,eslintConfigComponents:t})=>{if(void 0!==r&&void 0!==t)throw new a({message:"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously."})
|
|
29
|
+
return void 0===r&&(r=(({additional:e={},base:r=J,jsdoc:t=M,jsx:n=Q,test:i=U}={})=>[r,t,n,i,e])(t)),new c({fix:!1===e,overrideConfigFile:!0,overrideConfig:r,cwd:"/"})},G={arrowParens:"always",bracketSpacing:!0,printWidth:120,semi:!1,singleQuote:!0,trailingComma:"es5"},H=async e=>{const{check:r=!1,eslintConfig:t,eslintConfigComponents:i,prettierConfig:o=G}=e
|
|
30
30
|
if(void 0===e.files||0===e.files.length)throw new l({argumentName:"files",argumentType:"string[]",argumentValue:e.files})
|
|
31
31
|
const s=e.files.map(e=>n.resolve(e)),a=Object.assign({},e)
|
|
32
|
-
void 0===a.eslint&&(a.eslint=Y({check:r,eslintConfig:t,eslintConfigComponents:
|
|
33
|
-
const c=structuredClone(
|
|
32
|
+
void 0===a.eslint&&(a.eslint=Y({check:r,eslintConfig:t,eslintConfigComponents:i}))
|
|
33
|
+
const c=structuredClone(o)
|
|
34
34
|
c.parser="babel",a.prettierConfig=c
|
|
35
35
|
const p=(await Promise.all(s.map(e=>K(e,a)))).flat()
|
|
36
|
-
return{eslint:a.eslint,lintResults:p}},K=async(
|
|
36
|
+
return{eslint:a.eslint,lintResults:p}},K=async(i,{check:o=!1,eslint:l,noWrite:c=!1,outputDir:p,prettierConfig:m,relativeStem:d=process.cwd()})=>{const f=e(i,{encoding:"utf8"}),u=await f,g=!0===o?u:await s(u,m),y=await l.lintText(g,{filePath:i})
|
|
37
37
|
void 0===y[0].output&&g!==u&&(y[0].output=g)
|
|
38
38
|
const b=y[0].output
|
|
39
|
-
if(!0!==
|
|
40
|
-
if(void 0!==p){if(!
|
|
41
|
-
let t=
|
|
42
|
-
t.startsWith(n.sep)&&(t=t.slice(1)),e=n.join(p,t),await r(n.dirname(e),{recursive:!0})}const
|
|
43
|
-
await t(e,
|
|
39
|
+
if(!0!==o&&!0!==c&&(void 0!==b||void 0!==p)){let e=i
|
|
40
|
+
if(void 0!==p){if(!i.startsWith(e))throw new a({message:`Resolved input file path '${i}' does not start with effective source stem '${d}'.`,hint:"Check input file paths/selection patterns and set or harmonize '--relative-stem' option if necessary."})
|
|
41
|
+
let t=i.slice(d.length)
|
|
42
|
+
t.startsWith(n.sep)&&(t=t.slice(1)),e=n.join(p,t),await r(n.dirname(e),{recursive:!0})}const o=b||g
|
|
43
|
+
await t(e,o,{encoding:"utf8"})}return y}
|
|
44
44
|
export{H as formatAndLint,E as linebreakTypesExcept}
|
|
45
45
|
//# sourceMappingURL=fandl.js.map
|
package/dist/fandl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fandl.js","sources":["../src/lib/default-config/lib/linebreak-types-except.mjs","../src/lib/default-config/js-extensions.mjs","../src/lib/default-config/eslint-config.mjs","../src/lib/lib/get-eslint.mjs","../src/lib/default-config/prettier.config.mjs","../src/lib/format-and-lint.mjs"],"sourcesContent":["const linebreakTypes = [\n 'block',\n 'block-like',\n 'break',\n 'case',\n 'cjs-export',\n 'cjs-import',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'directive',\n 'do',\n 'empty',\n 'export',\n 'expression',\n 'for',\n 'function',\n 'if',\n 'iife',\n 'import',\n 'let',\n 'multiline-block-like',\n 'multiline-const',\n 'multiline-expression',\n 'multiline-let',\n 'multiline-var',\n 'return',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'switch',\n 'throw',\n 'try',\n 'var',\n 'while',\n 'with',\n]\n\n/**\n * A helper function used to sanely build 'blankline' entries in the '@stylistic/padding-line-between-statements' rule.\n * Basically, what we often want is to say \"we want a blank line between expression type A and all other expression\n * except for B, C, and D.\" This is useful because the '@stylistic/padding-line-between-statements' rule requires you\n * specify each type where a blank line is required, but it's generally easier to specify a set of expression types for\n * which a blank line is _NOT_ required.E.g.:\n *\n * ```javascript\n * '@stylistic/padding-line-between-statements' : [\n * 'error',\n * { blankLine : 'always', prev : '*', next : 'class' },\n * {\n * blankLine : 'always',\n * prev : linebreakTypesExcept('cjs-export', 'export'),\n * next : 'export',\n * },\n * ]\n * ```\n *\n * Would require (and/or add) a blank line between a class declaration and anything else, and a blank line between\n * `import` statements and all other statements except `import` or `cjs-import` statements. That way, all your `import`\n * statements would be grouped together, but would have a blank line between the last `import` and whatever the next\n * non-import statement is.\n * @param {...string} types - A list of the types to exclude from the rule (meaning all other known types are included).\n * @returns {string[]} - An array of the non-excluded types.\n */\nconst linebreakTypesExcept = (...types) => {\n const result = [...linebreakTypes]\n for (const type of types) {\n result.splice(result.indexOf(type), 1)\n }\n\n return result\n}\n\nexport { linebreakTypesExcept }\n","export const stdExts = ['.js', '.cjs', '.mjs']\nexport const jsxExts = ['.jsx']\nexport const allExts = [...stdExts, ...jsxExts]\nexport const stdExtsStr = stdExts.join(',')\nexport const jsxExtsStr = jsxExts.join(',')\nexport const allExtsStr = allExts.join(',')\n","/**\n * @file ESLint configuration file implementing (almost) [Standard JS style]{@link https://standardjs.com/},\n * [ESLint recommended js rules]{@link https://eslint.org/docs/latest/rules/},\n * [jsdoc rules]{@link https://www.npmjs.com/package/eslint-plugin-jsdoc} and, when appropriate,\n * [recommended node]{@link https://www.npmjs.com/package/eslint-plugin-node} and\n * [react]{@link https://www.npmjs.com/package/eslint-plugin-react} rules as well.\n *\n * Our one exception to the standard style is implementing aligned colons on multiline\n * 'key-spacing'. We think it makes things more readable. We also add a preference for regex literals where possible.\n */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport globalsPkg from 'globals'\nimport importPlugin from 'eslint-plugin-import'\nimport jsdocPlugin from 'eslint-plugin-jsdoc'\nimport nodePlugin from 'eslint-plugin-node'\nimport promisePlugin from 'eslint-plugin-promise'\nimport nPlugin from 'eslint-plugin-n'\nimport babelParser from '@babel/eslint-parser'\nimport { fixupPluginRules } from '@eslint/compat'\nimport js from '@eslint/js'\nimport stylistic from '@stylistic/eslint-plugin'\nimport standardConfig from 'eslint-config-standard-kit'\n\nimport { linebreakTypesExcept } from './lib/linebreak-types-except'\nimport { allExts, allExtsStr, jsxExtsStr } from './js-extensions'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\nconst babelConfigPathInstalled = join(__dirname, 'babel', 'babel.config.cjs')\nconst babelConfigPathTest = join('dist', 'babel', 'babel.config.cjs')\n\nconst babelConfigPath =\n existsSync(babelConfigPathInstalled) === true\n ? babelConfigPathInstalled\n : existsSync(babelConfigPathTest)\n ? babelConfigPathTest\n : undefined\nif (babelConfigPath === undefined) {\n throw new Error('Could not find babel config file.')\n}\n\nconst packageContents = readFileSync('./package.json', { encoding : 'utf8' })\nconst packageJSON = JSON.parse(packageContents)\nconst {\n dependencies = {},\n devDependencies = {},\n engines = { node : true },\n} = packageJSON\n\nconst standardPlugin = standardConfig({\n prettier : true,\n sortImports : true,\n jsx : true,\n node : true,\n react : true,\n typescript : true,\n})\n\nconst usesReact =\n dependencies.react !== undefined || devDependencies.react !== undefined\nconst reactSettings = usesReact ? { version : 'detect' } : {}\n\nconst stylisticConfig = stylistic.configs['recommended-flat']\n\nconst plugins = Object.assign(\n {\n standard : standardPlugin,\n import : importPlugin,\n promise : promisePlugin,\n n : nPlugin,\n },\n stylisticConfig.plugins // this names the plugin '@stylistic'\n)\n\nconst rules = {\n ...js.configs.recommended.rules,\n ...standardPlugin.rules,\n ...stylisticConfig.rules, // the stylistic rules also cover react rules\n // override key spacing to get things aligned\n '@stylistic/key-spacing' : [\n 'error',\n { align : 'colon', afterColon : true, beforeColon : true },\n ],\n // override to allow avoiding escapes\n '@stylistic/quotes' : [\n 'error',\n 'single',\n { allowTemplateLiterals : true, avoidEscape : true },\n ],\n // additional rules\n '@stylistic/arrow-parens' : ['error', 'always'], // I like this to be consistent\n '@stylistic/array-bracket-newline' : ['error', 'consistent'],\n '@stylistic/array-element-newline' : ['error', 'consistent'],\n '@stylistic/comma-dangle' : [\n 'error',\n {\n arrays : 'always-multiline',\n objects : 'always-multiline',\n imports : 'never',\n exports : 'never',\n functions : 'never',\n },\n ],\n '@stylistic/function-call-argument-newline' : ['error', 'consistent'],\n '@stylistic/function-call-spacing' : ['error', 'never'],\n '@stylistic/function-paren-newline' : ['error', 'consistent'],\n '@stylistic/indent' : [\n 'error',\n 2,\n {\n ArrayExpression : 1,\n CallExpression : { arguments : 1 },\n flatTernaryExpressions : false,\n FunctionDeclaration : { body : 1, parameters : 1 },\n FunctionExpression : { body : 1, parameters : 1 },\n ignoreComments : false,\n ignoredNodes : [\n 'TSUnionType',\n 'TSIntersectionType',\n 'TSTypeParameterInstantiation',\n 'FunctionExpression > .params[decorators.length > 0]',\n 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',\n ],\n ImportDeclaration : 1,\n MemberExpression : 1,\n ObjectExpression : 1,\n offsetTernaryExpressions : true,\n outerIIFEBody : 1,\n SwitchCase : 1,\n VariableDeclarator : 4,\n },\n ],\n '@stylistic/linebreak-style' : ['error', 'unix'],\n // '@stylistic/indent-binary-ops': ['error', 4], // same as default, but since we define indent, these two go together\n '@stylistic/max-statements-per-line' : ['error', { max : 2 }], // allow for short one-liners\n // The default is just 'before'; but equals are special. IMO.\n '@stylistic/operator-linebreak' : [\n 'error',\n 'before',\n { overrides : { '=' : 'after', '-=' : 'after', '+=' : 'after' } },\n ],\n '@stylistic/padding-line-between-statements' : [\n 'error',\n { blankLine : 'always', prev : '*', next : 'class' },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'export',\n },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'cjs-export',\n },\n {\n blankLine : 'always',\n prev : 'import',\n next : linebreakTypesExcept('import'),\n },\n {\n blankLine : 'always',\n prev : 'cjs-import',\n // Because a cjs-import is actually many different things...\n next : linebreakTypesExcept(\n 'cjs-import',\n 'const',\n 'let',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'var'\n ),\n },\n { blankLine : 'always', prev : '*', next : 'return' },\n ],\n // prettier insists on putting required semi-colons first, which is probably the better answer since it's more\n // resilient to code changes\n '@stylistic/semi-style' : ['error', 'first'],\n // The @stylistic default of 'always' for all seems at odd with general standards, which don't have space before\n // named functions. I like that because when we invoke a function, you never see a space, and I see no reason to\n // write the declaration different.\n '@stylistic/space-before-function-paren' : [\n 'error',\n { anonymous : 'always', asyncArrow : 'always', named : 'never' },\n ],\n '@stylistic/switch-colon-spacing' : ['error', { after : true, before : false }],\n // one-true-brace-style /is/ the more common, but i just don't like it. I think Stroustrup is easier to read *and*,\n // most important, with 1tbs, you can't do these kind of comments:\n //\n // if { ...\n // } // I really like to be able to put comments here\n // else if (some really conditional that means we'd have to put our comment inside the else-if!) {...}\n //\n // and I do those kind of comments sometime.\n // 'standard/brace-style' : ['errer', 'stroustrup', { allowSingleLine: true }],\n // TODO; looks like it's failing on the `export * from './foo'` statements; even though we have the babel pluggin`\n 'import/export' : 'off',\n // the standard 'no-unused-vars ignores unused args, which we'd rather catch. We also want to exclude 'React',\n // which we need to import for react to work, even when not used\n 'no-unused-vars' : ['error', { varsIgnorePattern : 'React' }],\n // style/consistency rules\n // this modifies JS Standard style\n 'prefer-regex-literals' : 'error',\n 'yoda' : ['error', 'never'],\n // use 'process.stdout'/'process.stderr' when you really want to communicate to the user\n 'no-console' : 'error',\n // efficiency rules\n 'no-await-in-loop' : 'error',\n // rules for odd code/possible red flags/unintentional logic\n 'no-lonely-if' : 'error',\n 'no-return-assign' : 'error',\n 'no-shadow' : 'error',\n 'no-extra-label' : 'error',\n 'no-label-var' : 'error',\n 'no-invalid-this' : 'error',\n 'no-unreachable-loop' : 'error',\n 'no-extra-bind' : 'error',\n 'require-await' : 'error',\n 'consistent-return' : 'error',\n 'default-case-last' : 'error',\n 'eqeqeq' : 'error',\n // limit code complexity\n 'complexity' : ['error', 20], // default val\n 'max-depth' : ['error', 4], // default val\n 'max-lines' : [\n 'error',\n { max : 300, skipBlankLines : true, skipComments : true },\n ], // default val,\n 'max-lines-per-function' : [\n 'error',\n { max : 50, skipBlankLines : true, skipComments : true },\n ],\n}\n\n// OK, so the standard plugin provides lots of nice rules, but there are some conflicts, so we delete them (and let the\n// @stylistic rules control).\ndelete rules['block-spacing'] // redundant with @stylistic\ndelete rules['brace-style'] // they want 1tbs, we want stroustrup\ndelete rules['comma-dangle'] // they so no, we say multiline\ndelete rules['eol-last'] // redundant with @stylistic\ndelete rules.indent\ndelete rules['indent-binary-ops']\ndelete rules['key-spacing'] // redundant with @stylistic\ndelete rules['operator-linebreak'] // they say after, we say before\ndelete rules['no-trailing-spaces'] // doesn't conflict, but it's redundant with @stylistic\ndelete rules['space-before-function-paren'] // we override default and redundant anyway\ndelete rules['@stylistic/indent-binary-ops'] // this is handled better by prettier\n// deprecated rules\ndelete rules['quote-props']\n\nconst allFiles = [`**/*{${allExtsStr}}`]\n\nconst defaultBaseConfig = {\n files : allFiles,\n languageOptions : {\n parser : babelParser,\n parserOptions : {\n sourceType : 'module',\n requireConfigFile : true,\n babelOptions : { configFile : babelConfigPath },\n ecmaFeatures : { jsx : true },\n },\n ecmaVersion : 'latest',\n },\n settings : { react : reactSettings },\n plugins,\n rules,\n}\n\nif (engines?.node !== undefined) {\n defaultBaseConfig.plugins.node = fixupPluginRules(nodePlugin)\n // TODO: actually, we don't want this for MJS files... but I'm not sure what we do want\n defaultBaseConfig.languageOptions.globals = globalsPkg.node\n Object.assign(defaultBaseConfig.rules, {\n ...nodePlugin.configs.recommended.rules,\n 'node/no-unsupported-features/es-syntax' : 'off', // we expect teh code to run through Babel, so it's fine\n 'node/prefer-promises/dns' : 'error',\n 'node/prefer-promises/fs' : 'error',\n 'node/no-missing-import' : [\n 'error',\n {\n tryExtensions : allExts,\n },\n ],\n })\n}\n\nconst defaultJsdocConfig = {\n files : allFiles,\n ignores : [`**/index{${allExtsStr}}`, '**/__tests__/**/*', '**/*.test.*'],\n plugins : { jsdoc : jsdocPlugin },\n rules : {\n ...jsdocPlugin.configs['flat/recommended-error'].rules,\n 'jsdoc/require-description' : 'error',\n // there is some indication that jsdoc should be able to divine default from ES6 default parameter settings (\n // e.g., func(foo = true)), but if this is possible, it's not working for us. (Prior to 2025)\n 'jsdoc/no-defaults' : 'off',\n // allow the dmd-readme-api plugin to define the 'category' tag\n 'jsdoc/check-tag-names' : ['error', { definedTags : ['category'] }],\n },\n}\n\nconst defaultJsxConfig = {\n files : [`**/*{${jsxExtsStr}}`],\n // add necessary globals when processing JSX files\n languageOptions : { globals : globalsPkg.browser },\n}\n\nconst defaultTestsConfig = {\n files : ['**/_tests_/**', `**/*.test{${allExtsStr}}`],\n // adds correct globals when processing jest tests\n languageOptions : { globals : globalsPkg.jest },\n rules : {\n // override default check for tests; Jest 'describe' functions can get very long, and that's OK\n 'max-lines-per-function' : 'off',\n },\n}\n\nconst getEslintConfig = ({\n additional = {},\n base = defaultBaseConfig,\n jsdoc = defaultJsdocConfig,\n jsx = defaultJsxConfig,\n test = defaultTestsConfig,\n} = {}) => {\n const eslintConfig = [base, jsdoc, jsx, test, additional]\n\n return eslintConfig\n}\n\nexport { getEslintConfig }\n","import { ESLint } from 'eslint'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { getEslintConfig } from '../default-config/eslint-config'\n\nconst getEslint = ({ check, eslintConfig, eslintConfigComponents }) => {\n if (eslintConfig !== undefined && eslintConfigComponents !== undefined) {\n throw new ArgumentInvalidError({\n message :\n \"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously.\",\n })\n }\n\n if (eslintConfig === undefined) {\n eslintConfig = getEslintConfig(eslintConfigComponents)\n }\n\n return new ESLint({\n fix : check === false,\n // this keeps eslint from insisting on an eslint config file\n overrideConfigFile : true,\n overrideConfig : eslintConfig,\n // This isn't necessary right now, but logically, it makes more sense. The difference is whether eslint looks for\n // config files relative to the base path (see below) or the file itself. In future, if/when we support config\n // override/augmentation, it makes sense to do it relative to the file, I think.\n // flags: ['unstable_config_lookup_from_file'],\n // By default, eslint sets the 'base path' to the CWD of the process and if the linted file isn't under the 'base\n // path', it is ignored. However, we expect either absolute file paths (from 'formatAndLint') or create absolute\n // file paths ourselves (from fandl CLI), so we set 'cwd' to '/' so no files are reject on that basis.\n cwd : '/',\n })\n}\n\nexport { getEslint }\n","const prettierConfig = {\n arrowParens : 'always',\n bracketSpacing : true,\n semi : false,\n singleQuote : true,\n trailingComma : 'es5',\n}\n\nexport { prettierConfig }\n","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport * as path from 'node:path'\n\nimport { format as prettierFormat } from 'prettier'\nimport { ArgumentInvalidError, ArgumentMissingError } from 'standard-error-set'\n\nimport { getEslint } from './lib/get-eslint'\nimport { prettierConfig as defaultPrettierConfig } from './default-config/prettier.config'\n\n/**\n * Parses, lints, and (when `check` is false) reformats the `files` text. By default, this function will update the\n * `files` in-place.\n * @param {object} options - The input options.\n * @param {boolean} [options.check = false] - If `true` then the files are linted, but not reformatted.\n * @param {boolean} [options.noWrite = false] - If `true`, then the files are not updated in placed. Has no effect when\n * `check = false`, but when combined with `check = true`, means that the text is reformatted and attached to the\n * `LintResult`s, but the files themselves are not updated. You can access reformatted text as part of the\n * `result.lintResults[0].output`. Unlike results directly from `ESLint`, `output` is\n * always present on the `LintResult` object (rather than only being set if the text is changed.\n * @param {object} [options.eslintConfig = <default eslint config>] - A flat (9.x) style array of [eslint configuration\n * object](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects) to be used in\n * place of the default, out of the box configuration. This may not be specified along with `eslintConfigComponents`.\n * @param {object} [options.eslintConfigComponents = undefined] - An object with zero or more keys corresponding to the\n * `base`, `jsdoc`, `jsx`, `test`, or `additional` as discussed in the [component based\n * configuration](#component-based-configuration). This may not be specified along with `eslintConfig`.\n * @param {object} [options.prettierConfig = <default prettier config>] - A prettier [options\n * object](https://prettier.io/docs/en/options).\n * @param {object} [options.eslint = undefined] - A pre-configured\n * [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class) instance. If this is defined, then\n * `eslintConfig` and `eslintConfigComponents` will be ignored.\n * @param {string} [options.outputDir = undefined] - If provided, then output files (whether reformatted or not) will be\n * written to the specified directory relative to their location in the source. With `src/index.mjs` =>\n * `<outputDir>/src/index.mjs`, `src/foo/bar.mjs` => `<outputDir>/src/foo/bar.mjs`. This option has no effect if\n * `check = true` or `noWrite = true`. The relative starting point is controlled with the `relativeStem` option.\n * @param {string} [options.relativeStem = process.cwd()] - Controls the starting point for determining the relative\n * position of files when emitting to `outputDir` rather than updating in place. Impossible stems will result in an\n * error. E.g., given file `src/index.mjs`, `relativeStem = 'src/foo'` is invalid.\n * @returns {Promise<{eslint: object, lintResults: object[]}>} Resolves to an object with two fields. `eslint` points\n * to the an instance of [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class). `lintResults`\n * points to an array of [`LintResult`](https://eslint.org/docs/latest/integrate/nodejs-api#-lintresult-type)s.\n */\nconst formatAndLint = async (options) => {\n const {\n // see 'processSource' for additional options\n check = false,\n eslintConfig,\n eslintConfigComponents,\n prettierConfig = defaultPrettierConfig,\n } = options\n\n if (options.files === undefined || options.files.length === 0) {\n throw new ArgumentMissingError({\n argumentName : 'files',\n argumentType : 'string[]',\n argumentValue : options.files,\n })\n }\n\n // make files absolute\n const files = options.files.map((f) => path.resolve(f))\n\n const processOptions = Object.assign({}, options)\n\n if (processOptions.eslint === undefined) {\n processOptions.eslint = getEslint({\n check,\n eslintConfig,\n eslintConfigComponents,\n })\n }\n\n const prettierParseConfig = structuredClone(prettierConfig)\n prettierParseConfig.parser = 'babel'\n processOptions.prettierConfig = prettierParseConfig\n\n const lintResults = (\n await Promise.all(files.map((file) => processSource(file, processOptions)))\n ).flat()\n\n return { eslint : processOptions.eslint, lintResults }\n}\n\nconst processSource = async (\n file,\n {\n check = false,\n eslint,\n noWrite = false,\n outputDir,\n prettierConfig,\n relativeStem = process.cwd(),\n }\n) => {\n const readPromise = readFile(file, { encoding : 'utf8' })\n const inputSource = await readPromise\n const prettierSource =\n check === true\n ? inputSource\n : await prettierFormat(inputSource, prettierConfig)\n const lintResults = await eslint.lintText(\n // we must specify the file path in order for the proper rules from the flat config to attach\n prettierSource,\n { filePath : file }\n )\n\n // the output is undefined if there are no changes due to the linting, but there may be changes due to prettier, so\n // to keep the ultimate result consistent, we have to update output if prettier did something\n if (lintResults[0].output === undefined && prettierSource !== inputSource) {\n lintResults[0].output = prettierSource\n }\n const formattedText = lintResults[0].output\n\n if (\n check !== true\n && noWrite !== true\n && (formattedText !== undefined || outputDir !== undefined)\n ) {\n let outputPath = file\n if (outputDir !== undefined) {\n if (!file.startsWith(outputPath)) {\n throw new ArgumentInvalidError({\n message : `Resolved input file path '${file}' does not start with effective source stem '${relativeStem}'.`,\n hint : \"Check input file paths/selection patterns and set or harmonize '--relative-stem' option if necessary.\",\n })\n }\n\n let relPath = file.slice(relativeStem.length)\n if (relPath.startsWith(path.sep)) {\n relPath = relPath.slice(1)\n }\n outputPath = path.join(outputDir, relPath)\n\n await mkdir(path.dirname(outputPath), { recursive : true })\n }\n\n const outputText = formattedText || prettierSource\n await writeFile(outputPath, outputText, { encoding : 'utf8' })\n }\n\n return lintResults\n}\n\nexport { formatAndLint }\n"],"names":["linebreakTypes","linebreakTypesExcept","types","result","type","splice","indexOf","jsxExts","allExts","jsxExtsStr","join","allExtsStr","babelConfigPathInstalled","dirname","fileURLToPath","url","babelConfigPathTest","babelConfigPath","existsSync","undefined","Error","packageContents","readFileSync","encoding","packageJSON","JSON","parse","dependencies","devDependencies","engines","node","standardPlugin","standardConfig","prettier","sortImports","jsx","react","typescript","reactSettings","version","stylisticConfig","stylistic","configs","plugins","Object","assign","standard","import","importPlugin","promise","promisePlugin","n","nPlugin","rules","js","recommended","align","afterColon","beforeColon","allowTemplateLiterals","avoidEscape","arrays","objects","imports","exports","functions","ArrayExpression","CallExpression","arguments","flatTernaryExpressions","FunctionDeclaration","body","parameters","FunctionExpression","ignoreComments","ignoredNodes","ImportDeclaration","MemberExpression","ObjectExpression","offsetTernaryExpressions","outerIIFEBody","SwitchCase","VariableDeclarator","max","overrides","blankLine","prev","next","anonymous","asyncArrow","named","after","before","varsIgnorePattern","yoda","eqeqeq","complexity","skipBlankLines","skipComments","indent","allFiles","defaultBaseConfig","files","languageOptions","parser","babelParser","parserOptions","sourceType","requireConfigFile","babelOptions","configFile","ecmaFeatures","ecmaVersion","settings","fixupPluginRules","nodePlugin","globals","globalsPkg","tryExtensions","defaultJsdocConfig","ignores","jsdoc","jsdocPlugin","definedTags","defaultJsxConfig","browser","defaultTestsConfig","jest","getEslint","check","eslintConfig","eslintConfigComponents","ArgumentInvalidError","message","getEslintConfig","additional","base","test","ESLint","fix","overrideConfigFile","overrideConfig","cwd","prettierConfig","arrowParens","bracketSpacing","semi","singleQuote","trailingComma","formatAndLint","async","defaultPrettierConfig","options","length","ArgumentMissingError","argumentName","argumentType","argumentValue","map","f","path","resolve","processOptions","eslint","prettierParseConfig","structuredClone","lintResults","Promise","all","file","processSource","flat","noWrite","outputDir","relativeStem","process","readPromise","readFile","inputSource","prettierSource","prettierFormat","lintText","filePath","output","formattedText","outputPath","startsWith","hint","relPath","slice","sep","mkdir","recursive","outputText","writeFile"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAMA,EAAiB,CACrB,QACA,aACA,QACA,OACA,aACA,aACA,QACA,QACA,WACA,WACA,UACA,YACA,KACA,QACA,SACA,aACA,MACA,WACA,KACA,OACA,SACA,MACA,uBACA,kBACA,uBACA,gBACA,gBACA,SACA,mBACA,iBACA,iBACA,SACA,QACA,MACA,MACA,QACA,QA6BIC,EAAuBA,IAAIC,KAC/B,MAAMC,EAAS,IAAIH;AACnB,IAAK,MAAMI,KAAQF,EACjBC,EAAOE,OAAOF,EAAOG,QAAQF,GAAO;AAGtC,OAAOD,GCvEII,EAAU,CAAC,QACXC,EAAU,CAFC,MAAO,OAAQ,UAEAD,GAE1BE,EAAaF,EAAQG,KAAK,KAC1BC,EAAaH,EAAQE,KAAK,KC0BjCE,EAA2BF,EAFfG,EAAQC,cAA0BC,MAEH,QAAS,oBACpDC,EAAsBN,EAAK,OAAQ,QAAS,oBAE5CO,GACqC,IAAzCC,EAAWN,GACPA,EACAM,EAAWF,GACTA,OACAG;AACR,QAAwBA,IAApBF,EACF,MAAM,IAAIG,MAAM;AAGlB,MAAMC,EAAkBC,EAAa,iBAAkB,CAAEC,SAAW,SAC9DC,EAAcC,KAAKC,MAAML,IACzBM,aACJA,EAAe,CAAA,EAAEC,gBACjBA,EAAkB,CAAA,EAAEC,QACpBA,EAAU,CAAEC,MAAO,IACjBN,EAEEO,EAAiBC,EAAe,CACpCC,UAAc,EACdC,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AZ2C,SACmBzJ,IAAlBqK,QAA6CrK,IAAd0J,GACnC,CACA,IAAIY,EAAahB;AACjB,QAAkBtJ,IAAd0J,EAAyB,CAC3B,IAAKJ,EAAKiB,WAAWD,GACnB,MAAM,IAAIrD,EAAqB,CAC7BC,QAAU,6BAA6BoC,iDAAoDK,MAC3Fa,KAAU;AAId,IAAIC,EAAUnB,EAAKoB,MAAMf,EAAarB;AAClCmC,EAAQF,WAAW1B,EAAK8B,OAC1BF,EAAUA,EAAQC,MAAM,IAE1BJ,EAAazB,EAAKtJ,KAAKmK,EAAWe,SAE5BG,EAAM/B,EAAKnJ,QAAQ4K,GAAa,CAAEO,WAAY,GACtD,CAEA,MAAMC,EAAaT,GAAiBL;MAC9Be,EAAUT,EAAYQ,EAAY,CAAE1K,SAAW,QACvD,CAEA,OAAO+I;"}
|
|
1
|
+
{"version":3,"file":"fandl.js","sources":["../src/lib/default-config/lib/linebreak-types-except.mjs","../src/lib/default-config/js-extensions.mjs","../src/lib/default-config/eslint-config.mjs","../src/lib/lib/get-eslint.mjs","../src/lib/default-config/prettier.config.mjs","../src/lib/format-and-lint.mjs"],"sourcesContent":["const linebreakTypes = [\n 'block',\n 'block-like',\n 'break',\n 'case',\n 'cjs-export',\n 'cjs-import',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'directive',\n 'do',\n 'empty',\n 'export',\n 'expression',\n 'for',\n 'function',\n 'if',\n 'iife',\n 'import',\n 'let',\n 'multiline-block-like',\n 'multiline-const',\n 'multiline-expression',\n 'multiline-let',\n 'multiline-var',\n 'return',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'switch',\n 'throw',\n 'try',\n 'var',\n 'while',\n 'with',\n]\n\n/**\n * A helper function used to sanely build 'blankline' entries in the '@stylistic/padding-line-between-statements' rule.\n * Basically, what we often want is to say \"we want a blank line between expression type A and all other expression\n * except for B, C, and D.\" This is useful because the '@stylistic/padding-line-between-statements' rule requires you\n * specify each type where a blank line is required, but it's generally easier to specify a set of expression types for\n * which a blank line is _NOT_ required.E.g.:\n *\n * ```javascript\n * '@stylistic/padding-line-between-statements' : [\n * 'error',\n * { blankLine : 'always', prev : '*', next : 'class' },\n * {\n * blankLine : 'always',\n * prev : linebreakTypesExcept('cjs-export', 'export'),\n * next : 'export',\n * },\n * ]\n * ```\n *\n * Would require (and/or add) a blank line between a class declaration and anything else, and a blank line between\n * `import` statements and all other statements except `import` or `cjs-import` statements. That way, all your `import`\n * statements would be grouped together, but would have a blank line between the last `import` and whatever the next\n * non-import statement is.\n * @param {...string} types - A list of the types to exclude from the rule (meaning all other known types are included).\n * @returns {string[]} - An array of the non-excluded types.\n */\nconst linebreakTypesExcept = (...types) => {\n const result = [...linebreakTypes]\n for (const type of types) {\n result.splice(result.indexOf(type), 1)\n }\n\n return result\n}\n\nexport { linebreakTypesExcept }\n","export const stdExts = ['.js', '.cjs', '.mjs']\nexport const jsxExts = ['.jsx']\nexport const allExts = [...stdExts, ...jsxExts]\nexport const stdExtsStr = stdExts.join(',')\nexport const jsxExtsStr = jsxExts.join(',')\nexport const allExtsStr = allExts.join(',')\n","/**\n * @file ESLint configuration file implementing (almost) [Standard JS style]{@link https://standardjs.com/},\n * [ESLint recommended js rules]{@link https://eslint.org/docs/latest/rules/},\n * [jsdoc rules]{@link https://www.npmjs.com/package/eslint-plugin-jsdoc} and, when appropriate,\n * [recommended node]{@link https://www.npmjs.com/package/eslint-plugin-node} and\n * [react]{@link https://www.npmjs.com/package/eslint-plugin-react} rules as well.\n *\n * Our one exception to the standard style is implementing aligned colons on multiline\n * 'key-spacing'. We think it makes things more readable. We also add a preference for regex literals where possible.\n */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport globalsPkg from 'globals'\nimport importPlugin from 'eslint-plugin-import'\nimport jsdocPlugin from 'eslint-plugin-jsdoc'\nimport nodePlugin from 'eslint-plugin-node'\nimport promisePlugin from 'eslint-plugin-promise'\nimport nPlugin from 'eslint-plugin-n'\nimport babelParser from '@babel/eslint-parser'\nimport { fixupPluginRules } from '@eslint/compat'\nimport js from '@eslint/js'\nimport stylistic from '@stylistic/eslint-plugin'\nimport standardConfig from 'eslint-config-standard-kit'\n\nimport { linebreakTypesExcept } from './lib/linebreak-types-except'\nimport { allExts, allExtsStr, jsxExtsStr } from './js-extensions'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\nconst babelConfigPathInstalled = join(__dirname, 'babel', 'babel.config.cjs')\nconst babelConfigPathTest = join('dist', 'babel', 'babel.config.cjs')\n\nconst babelConfigPath =\n existsSync(babelConfigPathInstalled) === true\n ? babelConfigPathInstalled\n : existsSync(babelConfigPathTest)\n ? babelConfigPathTest\n : undefined\nif (babelConfigPath === undefined) {\n throw new Error('Could not find babel config file.')\n}\n\nconst packageContents = readFileSync('./package.json', { encoding : 'utf8' })\nconst packageJSON = JSON.parse(packageContents)\nconst { dependencies = {}, devDependencies = {}, engines = { node : true } } = packageJSON\n\nconst standardPlugin = standardConfig({\n prettier : true,\n sortImports : true,\n jsx : true,\n node : true,\n react : true,\n typescript : true,\n})\n\nconst usesReact = dependencies.react !== undefined || devDependencies.react !== undefined\nconst reactSettings = usesReact ? { version : 'detect' } : {}\n\nconst stylisticConfig = stylistic.configs['recommended-flat']\n\nconst plugins = Object.assign(\n {\n standard : standardPlugin,\n import : importPlugin,\n promise : promisePlugin,\n n : nPlugin,\n },\n stylisticConfig.plugins // this names the plugin '@stylistic'\n)\n\nconst rules = {\n ...js.configs.recommended.rules,\n ...standardPlugin.rules,\n ...stylisticConfig.rules, // the stylistic rules also cover react rules\n // override key spacing to get things aligned\n '@stylistic/key-spacing' : ['error', { align : 'colon', afterColon : true, beforeColon : true }],\n // override to allow avoiding escapes\n '@stylistic/quotes' : ['error', 'single', { allowTemplateLiterals : true, avoidEscape : true }],\n // additional rules\n '@stylistic/arrow-parens' : ['error', 'always'], // I like this to be consistent\n '@stylistic/array-bracket-newline' : ['error', 'consistent'],\n '@stylistic/array-element-newline' : ['error', 'consistent'],\n '@stylistic/comma-dangle' : [\n 'error',\n {\n arrays : 'always-multiline',\n objects : 'always-multiline',\n imports : 'never',\n exports : 'never',\n functions : 'never',\n },\n ],\n '@stylistic/function-call-argument-newline' : ['error', 'consistent'],\n '@stylistic/function-call-spacing' : ['error', 'never'],\n '@stylistic/function-paren-newline' : ['error', 'consistent'],\n '@stylistic/indent' : [\n 'error',\n 2,\n {\n ArrayExpression : 1,\n CallExpression : { arguments : 1 },\n flatTernaryExpressions : false,\n FunctionDeclaration : { body : 1, parameters : 1 },\n FunctionExpression : { body : 1, parameters : 1 },\n ignoreComments : false,\n ignoredNodes : [\n 'TSUnionType',\n 'TSIntersectionType',\n 'TSTypeParameterInstantiation',\n 'FunctionExpression > .params[decorators.length > 0]',\n 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',\n ],\n ImportDeclaration : 1,\n MemberExpression : 1,\n ObjectExpression : 1,\n offsetTernaryExpressions : true,\n outerIIFEBody : 1,\n SwitchCase : 1,\n VariableDeclarator : 4,\n },\n ],\n '@stylistic/linebreak-style' : ['error', 'unix'],\n // '@stylistic/indent-binary-ops': ['error', 4], // same as default, but since we define indent, these two go together\n '@stylistic/max-statements-per-line' : ['error', { max : 2 }], // allow for short one-liners\n // The default is just 'before'; but equals are special. IMO.\n '@stylistic/operator-linebreak' : ['error', 'before', { overrides : { '=' : 'after', '-=' : 'after', '+=' : 'after' } }],\n '@stylistic/padding-line-between-statements' : [\n 'error',\n { blankLine : 'always', prev : '*', next : 'class' },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'export',\n },\n {\n blankLine : 'always',\n prev : linebreakTypesExcept('cjs-export', 'export'),\n next : 'cjs-export',\n },\n {\n blankLine : 'always',\n prev : 'import',\n next : linebreakTypesExcept('import'),\n },\n {\n blankLine : 'always',\n prev : 'cjs-import',\n // Because a cjs-import is actually many different things...\n next : linebreakTypesExcept(\n 'cjs-import',\n 'const',\n 'let',\n 'singleline-const',\n 'singleline-let',\n 'singleline-var',\n 'var'\n ),\n },\n { blankLine : 'always', prev : '*', next : 'return' },\n ],\n // prettier insists on putting required semi-colons first, which is probably the better answer since it's more\n // resilient to code changes\n '@stylistic/semi-style' : ['error', 'first'],\n // The @stylistic default of 'always' for all seems at odd with general standards, which don't have space before\n // named functions. I like that because when we invoke a function, you never see a space, and I see no reason to\n // write the declaration different.\n '@stylistic/space-before-function-paren' : ['error', { anonymous : 'always', asyncArrow : 'always', named : 'never' }],\n '@stylistic/switch-colon-spacing' : ['error', { after : true, before : false }],\n // one-true-brace-style /is/ the more common, but i just don't like it. I think Stroustrup is easier to read *and*,\n // most important, with 1tbs, you can't do these kind of comments:\n //\n // if { ...\n // } // I really like to be able to put comments here\n // else if (some really conditional that means we'd have to put our comment inside the else-if!) {...}\n //\n // and I do those kind of comments sometime.\n // 'standard/brace-style' : ['errer', 'stroustrup', { allowSingleLine: true }],\n // TODO; looks like it's failing on the `export * from './foo'` statements; even though we have the babel pluggin`\n 'import/export' : 'off',\n 'import/extensions' : [\n 'error', // or 'warn'\n 'never', // Default: disallow all extensions\n {\n svg : 'always', // Override: always allow .svg extension\n },\n ],\n // the standard 'no-unused-vars ignores unused args, which we'd rather catch. We also want to exclude 'React',\n // which we need to import for react to work, even when not used\n 'no-unused-vars' : ['error', { varsIgnorePattern : 'React' }],\n // style/consistency rules\n // this modifies JS Standard style\n 'prefer-regex-literals' : 'error',\n 'yoda' : ['error', 'never'],\n // use 'process.stdout'/'process.stderr' when you really want to communicate to the user\n 'no-console' : 'error',\n // efficiency rules\n 'no-await-in-loop' : 'error',\n // rules for odd code/possible red flags/unintentional logic\n 'no-lonely-if' : 'error',\n 'no-return-assign' : 'error',\n 'no-shadow' : 'error',\n 'no-extra-label' : 'error',\n 'no-label-var' : 'error',\n 'no-invalid-this' : 'error',\n 'no-unreachable-loop' : 'error',\n 'no-extra-bind' : 'error',\n 'require-await' : 'error',\n 'consistent-return' : 'error',\n 'default-case-last' : 'error',\n 'eqeqeq' : 'error',\n // limit code complexity\n 'complexity' : ['error', 20], // default val\n 'max-depth' : ['error', 4], // default val\n 'max-lines' : ['error', { max : 300, skipBlankLines : true, skipComments : true }], // default val,\n 'max-lines-per-function' : ['error', { max : 50, skipBlankLines : true, skipComments : true }],\n}\n\n// OK, so the standard plugin provides lots of nice rules, but there are some conflicts, so we delete them (and let the\n// @stylistic rules control).\ndelete rules['block-spacing'] // redundant with @stylistic\ndelete rules['brace-style'] // they want 1tbs, we want stroustrup\ndelete rules['comma-dangle'] // they so no, we say multiline\ndelete rules['eol-last'] // redundant with @stylistic\ndelete rules.indent\ndelete rules['indent-binary-ops']\ndelete rules['key-spacing'] // redundant with @stylistic\ndelete rules['operator-linebreak'] // they say after, we say before\ndelete rules['no-trailing-spaces'] // doesn't conflict, but it's redundant with @stylistic\ndelete rules['space-before-function-paren'] // we override default and redundant anyway\ndelete rules['@stylistic/indent-binary-ops'] // this is handled better by prettier\n// deprecated rules\ndelete rules['quote-props']\n\nconst allFiles = [`**/*{${allExtsStr}}`]\n\nconst defaultBaseConfig = {\n files : allFiles,\n languageOptions : {\n parser : babelParser,\n parserOptions : {\n sourceType : 'module',\n requireConfigFile : true,\n babelOptions : { configFile : babelConfigPath },\n ecmaFeatures : { jsx : true },\n },\n ecmaVersion : 'latest',\n },\n settings : { react : reactSettings },\n plugins,\n rules,\n}\n\nif (engines?.node !== undefined) {\n defaultBaseConfig.plugins.node = fixupPluginRules(nodePlugin)\n // TODO: actually, we don't want this for MJS files... but I'm not sure what we do want\n defaultBaseConfig.languageOptions.globals = globalsPkg.node\n Object.assign(defaultBaseConfig.rules, {\n ...nodePlugin.configs.recommended.rules,\n 'node/no-unsupported-features/es-syntax' : 'off', // we expect teh code to run through Babel, so it's fine\n 'node/prefer-promises/dns' : 'error',\n 'node/prefer-promises/fs' : 'error',\n 'node/no-missing-import' : [\n 'error',\n {\n tryExtensions : allExts,\n },\n ],\n })\n}\n\nconst defaultJsdocConfig = {\n files : allFiles,\n ignores : [`**/index{${allExtsStr}}`, '**/__tests__/**/*', '**/*.test.*'],\n plugins : { jsdoc : jsdocPlugin },\n rules : {\n ...jsdocPlugin.configs['flat/recommended-error'].rules,\n 'jsdoc/require-description' : 'error',\n // there is some indication that jsdoc should be able to divine default from ES6 default parameter settings (\n // e.g., func(foo = true)), but if this is possible, it's not working for us. (Prior to 2025)\n 'jsdoc/no-defaults' : 'off',\n // allow the dmd-readme-api plugin to define the 'category' tag\n 'jsdoc/check-tag-names' : ['error', { definedTags : ['category'] }],\n },\n}\n\nconst defaultJsxConfig = {\n files : [`**/*{${jsxExtsStr}}`],\n // add necessary globals when processing JSX files\n languageOptions : { globals : globalsPkg.browser },\n}\n\nconst defaultTestsConfig = {\n files : ['**/_tests_/**', `**/*.test{${allExtsStr}}`],\n // adds correct globals when processing jest tests\n languageOptions : { globals : globalsPkg.jest },\n rules : {\n // override default check for tests; Jest 'describe' functions can get very long, and that's OK\n 'max-lines-per-function' : 'off',\n 'max-lines' : ['error', { max : 500, skipBlankLines : true, skipComments : true }],\n },\n}\n\nconst getEslintConfig = ({\n additional = {},\n base = defaultBaseConfig,\n jsdoc = defaultJsdocConfig,\n jsx = defaultJsxConfig,\n test = defaultTestsConfig,\n} = {}) => {\n const eslintConfig = [base, jsdoc, jsx, test, additional]\n\n return eslintConfig\n}\n\nexport { getEslintConfig }\n","import { ESLint } from 'eslint'\nimport { ArgumentInvalidError } from 'standard-error-set'\n\nimport { getEslintConfig } from '../default-config/eslint-config'\n\nconst getEslint = ({ check, eslintConfig, eslintConfigComponents }) => {\n if (eslintConfig !== undefined && eslintConfigComponents !== undefined) {\n throw new ArgumentInvalidError({\n message : \"You cannot define 'eslintConfig' and 'eslintConfigComponents' simultaneously.\",\n })\n }\n\n if (eslintConfig === undefined) {\n eslintConfig = getEslintConfig(eslintConfigComponents)\n }\n\n return new ESLint({\n fix : check === false,\n // this keeps eslint from insisting on an eslint config file\n overrideConfigFile : true,\n overrideConfig : eslintConfig,\n // This isn't necessary right now, but logically, it makes more sense. The difference is whether eslint looks for\n // config files relative to the base path (see below) or the file itself. In future, if/when we support config\n // override/augmentation, it makes sense to do it relative to the file, I think.\n // flags: ['unstable_config_lookup_from_file'],\n // By default, eslint sets the 'base path' to the CWD of the process and if the linted file isn't under the 'base\n // path', it is ignored. However, we expect either absolute file paths (from 'formatAndLint') or create absolute\n // file paths ourselves (from fandl CLI), so we set 'cwd' to '/' so no files are reject on that basis.\n cwd : '/',\n })\n}\n\nexport { getEslint }\n","const prettierConfig = {\n arrowParens : 'always',\n bracketSpacing : true,\n printWidth : 120,\n semi : false,\n singleQuote : true,\n trailingComma : 'es5',\n}\n\nexport { prettierConfig }\n","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport * as path from 'node:path'\n\nimport { format as prettierFormat } from 'prettier'\nimport { ArgumentInvalidError, ArgumentMissingError } from 'standard-error-set'\n\nimport { getEslint } from './lib/get-eslint'\nimport { prettierConfig as defaultPrettierConfig } from './default-config/prettier.config'\n\n/**\n * Parses, lints, and (when `check` is false) reformats the `files` text. By default, this function will update the\n * `files` in-place.\n * @param {object} options - The input options.\n * @param {boolean} [options.check = false] - If `true` then the files are linted, but not reformatted.\n * @param {boolean} [options.noWrite = false] - If `true`, then the files are not updated in placed. Has no effect when\n * `check = false`, but when combined with `check = true`, means that the text is reformatted and attached to the\n * `LintResult`s, but the files themselves are not updated. You can access reformatted text as part of the\n * `result.lintResults[0].output`. Unlike results directly from `ESLint`, `output` is\n * always present on the `LintResult` object (rather than only being set if the text is changed.\n * @param {object} [options.eslintConfig = <default eslint config>] - A flat (9.x) style array of [eslint configuration\n * object](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects) to be used in\n * place of the default, out of the box configuration. This may not be specified along with `eslintConfigComponents`.\n * @param {object} [options.eslintConfigComponents = undefined] - An object with zero or more keys corresponding to the\n * `base`, `jsdoc`, `jsx`, `test`, or `additional` as discussed in the [component based\n * configuration](#component-based-configuration). This may not be specified along with `eslintConfig`.\n * @param {object} [options.prettierConfig = <default prettier config>] - A prettier [options\n * object](https://prettier.io/docs/en/options).\n * @param {object} [options.eslint = undefined] - A pre-configured\n * [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class) instance. If this is defined, then\n * `eslintConfig` and `eslintConfigComponents` will be ignored.\n * @param {string} [options.outputDir = undefined] - If provided, then output files (whether reformatted or not) will be\n * written to the specified directory relative to their location in the source. With `src/index.mjs` =>\n * `<outputDir>/src/index.mjs`, `src/foo/bar.mjs` => `<outputDir>/src/foo/bar.mjs`. This option has no effect if\n * `check = true` or `noWrite = true`. The relative starting point is controlled with the `relativeStem` option.\n * @param {string} [options.relativeStem = process.cwd()] - Controls the starting point for determining the relative\n * position of files when emitting to `outputDir` rather than updating in place. Impossible stems will result in an\n * error. E.g., given file `src/index.mjs`, `relativeStem = 'src/foo'` is invalid.\n * @returns {Promise<{eslint: object, lintResults: object[]}>} Resolves to an object with two fields. `eslint` points\n * to the an instance of [`ESLint`](https://eslint.org/docs/latest/integrate/nodejs-api#eslint-class). `lintResults`\n * points to an array of [`LintResult`](https://eslint.org/docs/latest/integrate/nodejs-api#-lintresult-type)s.\n */\nconst formatAndLint = async (options) => {\n const {\n // see 'processSource' for additional options\n check = false,\n eslintConfig,\n eslintConfigComponents,\n prettierConfig = defaultPrettierConfig,\n } = options\n\n if (options.files === undefined || options.files.length === 0) {\n throw new ArgumentMissingError({\n argumentName : 'files',\n argumentType : 'string[]',\n argumentValue : options.files,\n })\n }\n\n // make files absolute\n const files = options.files.map((f) => path.resolve(f))\n\n const processOptions = Object.assign({}, options)\n\n if (processOptions.eslint === undefined) {\n processOptions.eslint = getEslint({\n check,\n eslintConfig,\n eslintConfigComponents,\n })\n }\n\n const prettierParseConfig = structuredClone(prettierConfig)\n prettierParseConfig.parser = 'babel'\n processOptions.prettierConfig = prettierParseConfig\n\n const lintResults = (await Promise.all(files.map((file) => processSource(file, processOptions)))).flat()\n\n return { eslint : processOptions.eslint, lintResults }\n}\n\nconst processSource = async (\n file,\n { check = false, eslint, noWrite = false, outputDir, prettierConfig, relativeStem = process.cwd() }\n) => {\n const readPromise = readFile(file, { encoding : 'utf8' })\n const inputSource = await readPromise\n const prettierSource = check === true ? inputSource : await prettierFormat(inputSource, prettierConfig)\n const lintResults = await eslint.lintText(\n // we must specify the file path in order for the proper rules from the flat config to attach\n prettierSource,\n { filePath : file }\n )\n\n // the output is undefined if there are no changes due to the linting, but there may be changes due to prettier, so\n // to keep the ultimate result consistent, we have to update output if prettier did something\n if (lintResults[0].output === undefined && prettierSource !== inputSource) {\n lintResults[0].output = prettierSource\n }\n const formattedText = lintResults[0].output\n\n if (check !== true && noWrite !== true && (formattedText !== undefined || outputDir !== undefined)) {\n let outputPath = file\n if (outputDir !== undefined) {\n if (!file.startsWith(outputPath)) {\n throw new ArgumentInvalidError({\n message : `Resolved input file path '${file}' does not start with effective source stem '${relativeStem}'.`,\n hint : \"Check input file paths/selection patterns and set or harmonize '--relative-stem' option if necessary.\",\n })\n }\n\n let relPath = file.slice(relativeStem.length)\n if (relPath.startsWith(path.sep)) {\n relPath = relPath.slice(1)\n }\n outputPath = path.join(outputDir, relPath)\n\n await mkdir(path.dirname(outputPath), { recursive : true })\n }\n\n const outputText = formattedText || prettierSource\n await writeFile(outputPath, outputText, { encoding : 'utf8' })\n }\n\n return lintResults\n}\n\nexport { formatAndLint }\n"],"names":["linebreakTypes","linebreakTypesExcept","types","result","type","splice","indexOf","jsxExts","allExts","jsxExtsStr","join","allExtsStr","babelConfigPathInstalled","dirname","fileURLToPath","url","babelConfigPathTest","babelConfigPath","existsSync","undefined","Error","packageContents","readFileSync","encoding","packageJSON","JSON","parse","dependencies","devDependencies","engines","node","standardPlugin","standardConfig","prettier","sortImports","jsx","react","typescript","reactSettings","version","stylisticConfig","stylistic","configs","plugins","Object","assign","standard","import","importPlugin","promise","promisePlugin","n","nPlugin","rules","js","recommended","align","afterColon","beforeColon","allowTemplateLiterals","avoidEscape","arrays","objects","imports","exports","functions","ArrayExpression","CallExpression","arguments","flatTernaryExpressions","FunctionDeclaration","body","parameters","FunctionExpression","ignoreComments","ignoredNodes","ImportDeclaration","MemberExpression","ObjectExpression","offsetTernaryExpressions","outerIIFEBody","SwitchCase","VariableDeclarator","max","overrides","blankLine","prev","next","anonymous","asyncArrow","named","after","before","svg","varsIgnorePattern","yoda","eqeqeq","complexity","skipBlankLines","skipComments","indent","allFiles","defaultBaseConfig","files","languageOptions","parser","babelParser","parserOptions","sourceType","requireConfigFile","babelOptions","configFile","ecmaFeatures","ecmaVersion","settings","fixupPluginRules","nodePlugin","globals","globalsPkg","tryExtensions","defaultJsdocConfig","ignores","jsdoc","jsdocPlugin","definedTags","defaultJsxConfig","browser","defaultTestsConfig","jest","getEslint","check","eslintConfig","eslintConfigComponents","ArgumentInvalidError","message","getEslintConfig","additional","base","test","ESLint","fix","overrideConfigFile","overrideConfig","cwd","prettierConfig","arrowParens","bracketSpacing","printWidth","semi","singleQuote","trailingComma","formatAndLint","async","defaultPrettierConfig","options","length","ArgumentMissingError","argumentName","argumentType","argumentValue","map","f","path","resolve","processOptions","eslint","prettierParseConfig","structuredClone","lintResults","Promise","all","file","processSource","flat","noWrite","outputDir","relativeStem","process","readPromise","readFile","inputSource","prettierSource","prettierFormat","lintText","filePath","output","formattedText","outputPath","startsWith","hint","relPath","slice","sep","mkdir","recursive","outputText","writeFile"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAMA,EAAiB,CACrB,QACA,aACA,QACA,OACA,aACA,aACA,QACA,QACA,WACA,WACA,UACA,YACA,KACA,QACA,SACA,aACA,MACA,WACA,KACA,OACA,SACA,MACA,uBACA,kBACA,uBACA,gBACA,gBACA,SACA,mBACA,iBACA,iBACA,SACA,QACA,MACA,MACA,QACA,QA6BIC,EAAuBA,IAAIC,KAC/B,MAAMC,EAAS,IAAIH;AACnB,IAAK,MAAMI,KAAQF,EACjBC,EAAOE,OAAOF,EAAOG,QA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,OAAOiJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdlcforge/format-and-lint",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.29",
|
|
4
4
|
"description": "Pre-configured formatting and style tool combining prettier and eslint.",
|
|
5
5
|
"main": "./dist/fandl.js",
|
|
6
6
|
"type": "module",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"find-plus": "^2.0.0",
|
|
53
53
|
"gitignore-to-glob": "^0.3.0",
|
|
54
54
|
"globals": "^14.0.0",
|
|
55
|
-
"jest": "^29.7.0",
|
|
56
55
|
"js-yaml": "^4.1.0",
|
|
57
56
|
"prettier": "^3.3.3",
|
|
58
57
|
"standard-error-set": "^1.0.0-beta.2"
|
|
@@ -60,8 +59,9 @@
|
|
|
60
59
|
"devDependencies": {
|
|
61
60
|
"@liquid-labs/dmd": "^6.3.1",
|
|
62
61
|
"@liquid-labs/jsdoc-to-markdown": "^8.1.1",
|
|
63
|
-
"@liquid-labs/sdlc-resource-jest": "^1.0.0-alpha.
|
|
64
|
-
"dmd-readme-api": "^1.0.0-beta.8"
|
|
62
|
+
"@liquid-labs/sdlc-resource-jest": "^1.0.0-alpha.9",
|
|
63
|
+
"dmd-readme-api": "^1.0.0-beta.8",
|
|
64
|
+
"jest": "^30.2.0"
|
|
65
65
|
},
|
|
66
66
|
"_comply": {
|
|
67
67
|
"orgKey": "@liquid-labs"
|