263 lines
8.9 KiB
Nix
263 lines
8.9 KiB
Nix
{
|
|
inputs,
|
|
cell,
|
|
}: let
|
|
inherit (inputs) nixpkgs;
|
|
inherit (inputs.cells) std presets;
|
|
l = nixpkgs.lib // builtins;
|
|
in {
|
|
conform = {
|
|
data = {
|
|
commit = {
|
|
header = {length = 89;};
|
|
conventional = {
|
|
# Only allow these types of conventional commits (inspired by Angular)
|
|
types = [
|
|
"build"
|
|
"chore"
|
|
"ci"
|
|
"docs"
|
|
"feat"
|
|
"fix"
|
|
"perf"
|
|
"refactor"
|
|
"style"
|
|
"test"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
editorconfig = {
|
|
hook.mode = "copy"; # already useful before entering the devshell
|
|
data = {
|
|
root = true;
|
|
|
|
"*" = {
|
|
# Common
|
|
end_of_line = "lf";
|
|
insert_final_newline = true;
|
|
trim_trailing_whitespace = true;
|
|
charset = "utf-8";
|
|
indent_style = "space";
|
|
indent_size = 4;
|
|
indent_brace_style = "K&R";
|
|
max_line_length = 80;
|
|
tab_width = 4;
|
|
curly_bracket_next_line = true;
|
|
|
|
# Microsoft .NET properties
|
|
csharp_new_line_before_members_in_object_initializers = false;
|
|
csharp_preferred_modifier_order = "public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion";
|
|
csharp_space_after_cast = false;
|
|
csharp_style_var_elsewhere = "false:hint";
|
|
csharp_style_var_for_built_in_types = "false:hint";
|
|
csharp_style_var_when_type_is_apparent = "true:hint";
|
|
csharp_preserve_single_line_statements = false;
|
|
csharp_preserve_single_line_blocks = true;
|
|
dotnet_style_predefined_type_for_locals_parameters_members = "true:hint";
|
|
dotnet_style_predefined_type_for_member_access = "true:hint";
|
|
dotnet_style_qualification_for_event = "true:hint";
|
|
dotnet_style_qualification_for_field = "true:hint";
|
|
dotnet_style_qualification_for_method = "true:hint";
|
|
dotnet_style_qualification_for_property = "true:hint";
|
|
dotnet_style_require_accessibility_modifiers = "for_non_interface_members:hint";
|
|
|
|
# ReSharper properties
|
|
resharper_alignment_tab_fill_style = "optimal_fill";
|
|
resharper_apply_on_completion = true;
|
|
resharper_blank_lines_after_control_transfer_statements = 1;
|
|
resharper_blank_lines_around_single_line_auto_property = 1;
|
|
resharper_blank_lines_around_single_line_property = 1;
|
|
resharper_blank_lines_before_single_line_comment = 1;
|
|
resharper_blank_lines_between_using_groups = 1;
|
|
resharper_braces_for_for = "required";
|
|
resharper_braces_for_foreach = "required";
|
|
resharper_braces_for_ifelse = "required";
|
|
resharper_braces_for_while = "required";
|
|
resharper_can_use_global_alias = false;
|
|
resharper_csharp_blank_lines_around_single_line_field = 1;
|
|
resharper_csharp_blank_lines_around_single_line_invocable = 1;
|
|
resharper_csharp_indent_style = "tab";
|
|
resharper_csharp_insert_final_newline = true;
|
|
resharper_csharp_keep_blank_lines_in_code = 1;
|
|
resharper_csharp_keep_blank_lines_in_declarations = 1;
|
|
resharper_csharp_new_line_before_while = true;
|
|
resharper_csharp_use_indent_from_vs = false;
|
|
resharper_csharp_wrap_arguments_style = "chop_if_long";
|
|
resharper_csharp_wrap_extends_list_style = "chop_if_long";
|
|
resharper_csharp_wrap_parameters_style = "chop_if_long";
|
|
resharper_css_insert_final_newline = false;
|
|
resharper_enforce_line_ending_style = true;
|
|
resharper_html_insert_final_newline = false;
|
|
resharper_indent_nested_fixed_stmt = true;
|
|
resharper_js_indent_style = "tab";
|
|
resharper_js_insert_final_newline = true;
|
|
resharper_js_keep_blank_lines_in_code = 1;
|
|
resharper_js_stick_comment = false;
|
|
resharper_js_use_indent_from_vs = false;
|
|
resharper_js_wrap_before_binary_opsign = true;
|
|
resharper_js_wrap_chained_method_calls = "chop_if_long";
|
|
resharper_keep_blank_lines_between_declarations = 1;
|
|
resharper_min_blank_lines_after_imports = 1;
|
|
resharper_place_attribute_on_same_line = false;
|
|
resharper_place_constructor_initializer_on_same_line = false;
|
|
resharper_place_type_constraints_on_same_line = false;
|
|
resharper_protobuf_insert_final_newline = false;
|
|
resharper_qualified_using_at_nested_scope = true;
|
|
resharper_resx_insert_final_newline = false;
|
|
resharper_space_within_single_line_array_initializer_braces = true;
|
|
resharper_use_indents_from_main_language_in_file = false;
|
|
resharper_vb_insert_final_newline = false;
|
|
resharper_wrap_after_declaration_lpar = true;
|
|
resharper_wrap_after_invocation_lpar = true;
|
|
resharper_wrap_before_extends_colon = true;
|
|
resharper_wrap_before_first_type_parameter_constraint = true;
|
|
resharper_wrap_before_type_parameter_langle = true;
|
|
resharper_xmldoc_indent_child_elements = "ZeroIndent";
|
|
resharper_xmldoc_indent_text = "ZeroIndent";
|
|
resharper_xmldoc_insert_final_newline = false;
|
|
resharper_xml_insert_final_newline = false;
|
|
|
|
# ReSharper inspection severities
|
|
resharper_check_namespace_highlighting = "none";
|
|
resharper_convert_to_auto_property_highlighting = "none";
|
|
resharper_localizable_element_highlighting = "none";
|
|
resharper_redundant_comma_in_attribute_list_highlighting = "none";
|
|
resharper_redundant_comma_in_enum_declaration_highlighting = "none";
|
|
resharper_redundant_comma_in_initializer_highlighting = "none";
|
|
resharper_string_compare_to_is_culture_specific_highlighting = "none";
|
|
resharper_string_index_of_is_culture_specific_1_highlighting = "none";
|
|
resharper_use_null_propagation_highlighting = "none";
|
|
resharper_use_object_or_collection_initializer_highlighting = "hint";
|
|
resharper_use_string_interpolation_highlighting = "hint";
|
|
};
|
|
|
|
"*.{diff,patch}" = {
|
|
end_of_line = "unset";
|
|
insert_final_newline = "unset";
|
|
trim_trailing_whitespace = "unset";
|
|
indent_size = "unset";
|
|
};
|
|
|
|
"*.md" = {
|
|
max_line_length = "off";
|
|
trim_trailing_whitespace = false;
|
|
};
|
|
|
|
"package.json" = {
|
|
indent_style = "space";
|
|
indent_size = 2;
|
|
tab_width = 2;
|
|
};
|
|
|
|
"*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}" = {
|
|
indent_style = "space";
|
|
indent_size = 2;
|
|
tab_width = 2;
|
|
};
|
|
|
|
"{LICENSES/**,LICENSE}" = {
|
|
end_of_line = "unset";
|
|
insert_final_newline = "unset";
|
|
trim_trailing_whitespace = "unset";
|
|
charset = "unset";
|
|
indent_style = "unset";
|
|
indent_size = "unset";
|
|
};
|
|
};
|
|
};
|
|
|
|
lefthook = {
|
|
data = {
|
|
commit-msg = {
|
|
commands = {
|
|
# Runs conform on commit-msg hook to ensure commit messages are
|
|
# compliant.
|
|
conform = {
|
|
run = "${nixpkgs.conform}/bin/conform enforce --commit-msg-file {1}";
|
|
};
|
|
};
|
|
};
|
|
pre-commit = {
|
|
commands = {
|
|
# Runs treefmt on pre-commit hook to ensure checked-in source code is
|
|
# properly formatted.
|
|
treefmt = {
|
|
run = "${nixpkgs.treefmt}/bin/treefmt {staged_files}";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
prettier = {
|
|
data = {
|
|
printWidth = 80;
|
|
proseWrap = "always";
|
|
};
|
|
output = ".prettierrc";
|
|
format = "json";
|
|
};
|
|
|
|
treefmt = {
|
|
data = {
|
|
formatter = {
|
|
dotnet = {
|
|
command = "dotnet";
|
|
options = ["jb" "cleanupcode"];
|
|
includes = ["*.cs"];
|
|
};
|
|
|
|
nix = {
|
|
command = "alejandra";
|
|
includes = ["*.nix" "*.nix.hbs"];
|
|
};
|
|
|
|
prettier = {
|
|
command = "prettier";
|
|
# 2023-09-02 DREM: Removed "--plugin" "prettier-plugin-toml"
|
|
options = ["--write"];
|
|
includes = [
|
|
"*.css"
|
|
"*.html"
|
|
"*.js"
|
|
"*.json"
|
|
"*.jsx"
|
|
"*.md"
|
|
"*.mdx"
|
|
"*.scss"
|
|
"*.ts"
|
|
"*.yaml"
|
|
#"*.toml"
|
|
];
|
|
};
|
|
|
|
shell = {
|
|
command = "shfmt";
|
|
options = ["-i" "4" "-s" "-w"];
|
|
includes = ["*.sh"];
|
|
};
|
|
|
|
# We mainly use it here to format the Markdown in our README.
|
|
prettier = {
|
|
excludes = ["**.min.js"];
|
|
};
|
|
};
|
|
};
|
|
|
|
packages = [
|
|
nixpkgs.alejandra
|
|
nixpkgs.nodePackages.prettier
|
|
nixpkgs.nodePackages.prettier-plugin-toml
|
|
nixpkgs.shfmt
|
|
nixpkgs.go
|
|
];
|
|
|
|
#devshell.startup.prettier-plugin-toml = l.stringsWithDeps.noDepEntry ''
|
|
# export NODE_PATH=${nixpkgs.nodePackages.prettier-plugin-toml}/lib/node_modules:$NODE_PATH
|
|
#'';
|
|
};
|
|
}
|