Files
authentik/packages/prettier-config/lib/constants.js
Teffen Ellis d007cbc817 web: CodeSpell -> CSpell migration (#20188)
* web: Flesh out CSpell.

* Fix remaining linter warnings.

* Add comments, common names.

* Fix common prefixes.

* Omit trailing commas in jsonc files.

* Format.

* Update command.

* Install before run.

* trim empty lines

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* dont npm ci there

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* setup node in web and root

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* Format.

* Rename.

* Install root deps.

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
2026-03-09 18:18:38 +01:00

116 lines
2.6 KiB
JavaScript

/**
* @file Prettier configuration for authentik.
*
* @import { Config as PrettierConfig } from "prettier";
*/
import { fileURLToPath } from "node:url";
/**
* @typedef {object} PackageJSONPluginConfig
* @property {string[]} [packageSortOrder] Custom ordering array.
*/
/**
* @typedef {PrettierConfig & PackageJSONPluginConfig} ExtendedPrettierConfig
*/
const CI = !!process.env.CI;
/**
* @type {ExtendedPrettierConfig['plugins']}
*/
const plugins = [
// ---
fileURLToPath(import.meta.resolve("@goauthentik/prettier-config/imports-plugin")),
];
/**
* @type {ExtendedPrettierConfig['overrides']}
*/
const overrides = [
{
files: "schemas/**/*.json",
options: {
tabWidth: 2,
},
},
{
files: ["tsconfig.json", "*.jsonc"],
options: {
trailingComma: "none",
},
},
];
// Sort order can be a source of false-positives in CI when this package is updated.
if (!CI) {
plugins.unshift("prettier-plugin-packagejson");
overrides.push({
files: "package.json",
options: {
packageSortOrder: [
// ---
"name",
"version",
"description",
"license",
"private",
"author",
"authors",
"contributors",
"funding",
"repository",
"bugs",
"homepage",
"scripts",
"main",
"type",
"types",
"exports",
"imports",
"dependencies",
"devDependencies",
"peerDependencies",
"optionalDependencies",
"workspaces",
"files",
"wireit",
"resolutions",
"engines",
"devEngines",
"packageManager",
"prettier",
"eslintConfig",
],
},
});
}
/**
* authentik Prettier configuration.
*
* @type {ExtendedPrettierConfig}
* @internal
*/
export const AuthentikPrettierConfig = {
arrowParens: "always",
bracketSpacing: true,
embeddedLanguageFormatting: "auto",
htmlWhitespaceSensitivity: "css",
insertPragma: false,
jsxSingleQuote: false,
printWidth: 100,
proseWrap: "preserve",
quoteProps: "consistent",
requirePragma: false,
semi: true,
singleQuote: false,
tabWidth: 4,
trailingComma: "all",
useTabs: false,
vueIndentScriptAndStyle: false,
plugins,
overrides,
};