@stanfordspezi/spezi-web-configurations
Version:
Stanford Biodesign Digital Health Spezi Web Configurations
428 lines (405 loc) • 16.2 kB
JavaScript
var $5paZa$eslintjs = require("@eslint/js");
var $5paZa$globals = require("globals");
var $5paZa$eslintpluginreacthooks = require("eslint-plugin-react-hooks");
var $5paZa$typescripteslint = require("typescript-eslint");
var $5paZa$eslintpluginreact = require("eslint-plugin-react");
var $5paZa$eslintpluginpreferarrowfunctions = require("eslint-plugin-prefer-arrow-functions");
var $5paZa$eslintpluginprettierrecommended = require("eslint-plugin-prettier/recommended");
var $5paZa$eslintpluginimport = require("eslint-plugin-import");
function $parcel$exportWildcard(dest, source) {
Object.keys(source).forEach(function(key) {
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
return;
}
Object.defineProperty(dest, key, {
enumerable: true,
get: function get() {
return source[key];
}
});
});
return dest;
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
//
// This source file is part of the Stanford Biodesign Digital Health Spezi Web Configurations open-source project
//
// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
var $87ab418b9b40430c$exports = {};
$parcel$export($87ab418b9b40430c$exports, "getIgnoredDirs", () => $87ab418b9b40430c$export$e1c38582a0bbef82);
$parcel$export($87ab418b9b40430c$exports, "getEslintRules", () => $87ab418b9b40430c$export$eb1f21f88d34bdfb);
$parcel$export($87ab418b9b40430c$exports, "getImportRules", () => $87ab418b9b40430c$export$225eea464053efcd);
$parcel$export($87ab418b9b40430c$exports, "getNodeGlobals", () => $87ab418b9b40430c$export$fbe9a5d44c391d0b);
$parcel$export($87ab418b9b40430c$exports, "getPreferArrowFunctions", () => $87ab418b9b40430c$export$b8aad89adc501f97);
$parcel$export($87ab418b9b40430c$exports, "getTslint", () => $87ab418b9b40430c$export$e3e6025991f9e3c7);
$parcel$export($87ab418b9b40430c$exports, "getReactPlugins", () => $87ab418b9b40430c$export$76d2d3e7d2c650e2);
$parcel$export($87ab418b9b40430c$exports, "getIgnoreDefaultExportRule", () => $87ab418b9b40430c$export$310764c8e6f574e6);
$parcel$export($87ab418b9b40430c$exports, "getTransformAllRulesToWarn", () => $87ab418b9b40430c$export$b381a54af03b188f);
$parcel$export($87ab418b9b40430c$exports, "getEslintReactConfig", () => $87ab418b9b40430c$export$96477aaf9e3c0811);
$parcel$export($87ab418b9b40430c$exports, "getEslintNodeConfig", () => $87ab418b9b40430c$export$cb5a1007164fc66b);
//
// This source file is part of the Stanford Biodesign Digital Health Spezi Web Configurations open-source project
//
// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
const $87ab418b9b40430c$export$e1c38582a0bbef82 = ()=>({
ignores: [
"dist",
"docs",
"out",
"coverage",
".next",
"**/playwright-report"
]
});
const $87ab418b9b40430c$export$eb1f21f88d34bdfb = ()=>[
(0, ($parcel$interopDefault($5paZa$eslintjs))).configs.recommended,
{
rules: {
"no-empty-pattern": "off"
}
}
];
const $87ab418b9b40430c$export$225eea464053efcd = (tsConfigsDirs)=>[
$5paZa$eslintpluginimport.flatConfigs.recommended,
$5paZa$eslintpluginimport.flatConfigs.typescript,
{
settings: {
"import/resolver": {
typescript: {
project: [
"./tsconfig.json",
...tsConfigsDirs
]
}
}
}
},
{
files: [
"**/*.{js,jsx,ts,tsx}"
],
rules: {
"import/order": [
"warn",
{
groups: [
"builtin",
"external",
"internal",
[
"parent",
"sibling"
]
],
pathGroupsExcludedImportTypes: [
"builtin"
],
"newlines-between": "never",
alphabetize: {
order: "asc",
caseInsensitive: true
}
}
],
"import/no-empty-named-blocks": "error",
"import/no-mutable-exports": "error",
"import/no-cycle": "error",
"import/extensions": [
"warn",
"always",
{
ts: "never",
tsx: "never",
js: "never",
jsx: "never",
mjs: "never"
}
],
"import/newline-after-import": "warn",
"import/no-anonymous-default-export": "warn",
"import/no-default-export": "error",
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
// false negatives
"import/namespace": [
"off"
]
}
}
];
const $87ab418b9b40430c$export$fbe9a5d44c391d0b = ()=>({
files: [
"**/eslint.config.?(c)js",
"**/.prettierrc.?(c)js",
"**/postcss.config.?(c)js",
"**/tailwind.config.?(c)js"
],
languageOptions: {
globals: (0, ($parcel$interopDefault($5paZa$globals))).node
}
});
const $87ab418b9b40430c$export$b8aad89adc501f97 = ()=>({
files: [
"**/*.{js,jsx,ts,tsx}"
],
plugins: {
"prefer-arrow-functions": $5paZa$eslintpluginpreferarrowfunctions
},
rules: {
"prefer-arrow-functions/prefer-arrow-functions": [
"warn",
{
allowedNames: [],
allowNamedFunctions: false,
allowObjectProperties: true,
classPropertiesAllowed: false,
disallowPrototype: false,
returnStyle: "unchanged",
singleReturnOnly: false
}
]
}
});
const $87ab418b9b40430c$export$e3e6025991f9e3c7 = ()=>({
extends: [
(0, ($parcel$interopDefault($5paZa$typescripteslint))).configs.strictTypeChecked,
(0, ($parcel$interopDefault($5paZa$typescripteslint))).configs.stylisticTypeChecked
],
files: [
"**/*.{ts,tsx}"
],
processor: {
preprocess: (text)=>[
text
],
postprocess: (messagesList)=>messagesList.flat().map((message)=>{
if (message.ruleId === "@typescript-eslint/naming-convention") return {
...message,
message: "Variable name `e` is not allowed. Use a more descriptive name like `error` or `event`."
};
return message;
}),
supportsAutofix: true
},
rules: {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
disallowTypeAnnotations: false
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
attributes: false
}
}
],
"@typescript-eslint/no-empty-object-type": [
"error",
// `interface SpecificVariantProps extends VariantProps {}` is fine
{
allowInterfaces: "with-single-extends"
}
],
// make sure to `await` inside try…catch
"@typescript-eslint/return-await": [
"error",
"in-try-catch"
],
"@typescript-eslint/no-confusing-void-expression": [
"error",
{
ignoreArrowShorthand: true
}
],
// empty interfaces are fine, e.g. React component that extends other component, but with no additional props
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/array-type": [
"warn",
{
default: "array-simple",
readonly: "array-simple"
}
],
// allow unused vars prefixed with `_`
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}
],
"@typescript-eslint/restrict-template-expressions": [
"error",
// numbers and booleans are fine in template strings
{
allowNumber: true,
allowBoolean: true
}
],
// notFound in Tanstack Router is thrown
"@typescript-eslint/only-throw-error": "off",
"@typescript-eslint/no-restricted-imports": [
"error",
{
name: "react",
importNames: [
"default"
],
message: "Import specific types directly: import { ReactNode } from 'react'"
}
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: null,
custom: {
regex: "^e$",
match: false
}
},
{
selector: "parameter",
format: null,
custom: {
regex: "^e$",
match: false
}
}
]
}
});
const $87ab418b9b40430c$export$76d2d3e7d2c650e2 = ()=>[
(0, ($parcel$interopDefault($5paZa$eslintpluginreacthooks))).configs.flat["recommended-latest"],
{
...(0, ($parcel$interopDefault($5paZa$eslintpluginreact))).configs.flat.recommended,
settings: {
react: {
version: "detect"
}
},
rules: {
...(0, ($parcel$interopDefault($5paZa$eslintpluginreact))).configs.flat.recommended.rules,
"react/jsx-curly-brace-presence": [
"warn",
{
props: "never",
children: "never",
propElementValues: "always"
}
],
"react/no-unescaped-entities": "off",
"react/jsx-fragments": [
"warn",
"syntax"
],
"react/prop-types": "off",
"react/self-closing-comp": [
"warn",
{
component: true,
html: false
}
]
}
},
(0, ($parcel$interopDefault($5paZa$eslintpluginreact))).configs.flat["jsx-runtime"]
];
const $87ab418b9b40430c$export$310764c8e6f574e6 = ()=>({
files: [
"{app,pages}/**/*.ts?(x)",
"**/playwright.config.ts",
"**/tailwind.config.ts",
"**/vite.config.ts",
"**/*.stories.ts?(x)",
"**/.storybook/**/*.ts?(x)",
"**/.prettierrc.{ts,js}",
"**/eslint.config.{ts,js}"
],
rules: {
"import/no-default-export": "off"
}
});
const $87ab418b9b40430c$export$b381a54af03b188f = ()=>({
rules: {},
languageOptions: {},
processor: {
preprocess: (text)=>[
text
],
postprocess: (messages)=>messages.flat().map((message)=>({
...message,
severity: 1
})),
supportsAutofix: true
}
});
/**
* Forces correct prettier formatting with auto-fix support
* */ const $87ab418b9b40430c$var$getPrettierPlugin = ()=>[
(0, ($parcel$interopDefault($5paZa$eslintpluginprettierrecommended)))
];
const $87ab418b9b40430c$export$96477aaf9e3c0811 = ({ tsconfigRootDir: tsconfigRootDir, tsConfigsDirs: tsConfigsDirs = [], changeEveryRuleToWarning: changeEveryRuleToWarning })=>{
return (0, ($parcel$interopDefault($5paZa$typescripteslint))).config($87ab418b9b40430c$export$e1c38582a0bbef82(), ...$87ab418b9b40430c$export$eb1f21f88d34bdfb(), ...$87ab418b9b40430c$export$225eea464053efcd(tsConfigsDirs), $87ab418b9b40430c$export$fbe9a5d44c391d0b(), {
...$87ab418b9b40430c$export$e3e6025991f9e3c7(),
languageOptions: {
ecmaVersion: 2020,
globals: (0, ($parcel$interopDefault($5paZa$globals))).browser,
parserOptions: {
projectService: true,
tsconfigRootDir: tsconfigRootDir
}
}
}, $87ab418b9b40430c$export$b8aad89adc501f97(), ...$87ab418b9b40430c$export$76d2d3e7d2c650e2(), ...$87ab418b9b40430c$var$getPrettierPlugin(), $87ab418b9b40430c$export$310764c8e6f574e6(), changeEveryRuleToWarning ? $87ab418b9b40430c$export$b381a54af03b188f() : {});
};
const $87ab418b9b40430c$export$cb5a1007164fc66b = ({ tsconfigRootDir: tsconfigRootDir, tsConfigsDirs: tsConfigsDirs = [], changeEveryRuleToWarning: changeEveryRuleToWarning })=>{
return (0, ($parcel$interopDefault($5paZa$typescripteslint))).config($87ab418b9b40430c$export$e1c38582a0bbef82(), ...$87ab418b9b40430c$export$eb1f21f88d34bdfb(), ...$87ab418b9b40430c$export$225eea464053efcd(tsConfigsDirs), $87ab418b9b40430c$export$fbe9a5d44c391d0b(), {
...$87ab418b9b40430c$export$e3e6025991f9e3c7(),
languageOptions: {
ecmaVersion: 2020,
globals: (0, ($parcel$interopDefault($5paZa$globals))).node,
parserOptions: {
projectService: true,
tsconfigRootDir: tsconfigRootDir
}
}
}, $87ab418b9b40430c$export$b8aad89adc501f97(), ...$87ab418b9b40430c$var$getPrettierPlugin(), $87ab418b9b40430c$export$310764c8e6f574e6(), changeEveryRuleToWarning ? $87ab418b9b40430c$export$b381a54af03b188f() : {});
};
var $7eef3883c4457fd8$exports = {};
$parcel$export($7eef3883c4457fd8$exports, "prettierConfig", () => $7eef3883c4457fd8$export$afe7f6f62e0066a0);
//
// This source file is part of the Stanford Biodesign Digital Health Spezi Web Configurations open-source project
//
// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
const $7eef3883c4457fd8$export$afe7f6f62e0066a0 = {
plugins: [
"prettier-plugin-tailwindcss"
],
experimentalTernaries: true
};
$parcel$exportWildcard(module.exports, $87ab418b9b40430c$exports);
$parcel$exportWildcard(module.exports, $7eef3883c4457fd8$exports);
//# sourceMappingURL=index.js.map