shtukbasehub

Standard: EditorConfig

EditorConfig: the project has an .editorconfig with root = true, and files follow it: line endings, a final newline, trailing whitespace, encoding; indentation and line length are observed.

Packagestd-editorconfigv0.1.011 files

Standard: EditorConfig

What the standard is. EditorConfig is an .editorconfig file where a project sets how editors save files: line endings, indentation, encoding. The specification: https://spec.editorconfig.org/ (version 0.17.2), the site https://editorconfig.org/. The file has sections with globs ([*.rs]), and properties in them. The .editorconfig nearest to a file outweighs a farther one; the search up through folders ends at a file with root = true.

When to install. People and agents write in the project in different editors and on different systems. Without shared rules, CRLF appears next to LF, along with trailing whitespace and "whole-file" edits that hide the point of a change.

How to configure. The rules themselves are in the project's .editorconfig: the package does not invent them but checks them. The page /norms/standards/editorconfig.md: what not to check (exclude, globs from the root; by default vendor/, third_party/, fixtures), the file size limit (maxBytes) and changedSince, to check only files touched since that day. changedSince is for a project with old debt: new edits are clean, old ones are fixed gradually.

Files are taken from git (tracked and new ones, without ignored ones); without git, by walking folders without node_modules, target, dist and similar. Binary files are skipped.

What is checked

  • EC-R01 (MUST, enforce): .editorconfig exists in the root or above, the search ends at root = true, and the file has at least one section. The present check.
  • EC-R02 (MUST, enforce): a file matches the exact properties: end_of_line (lf, crlf, cr), insert_final_newline = true, trim_trailing_whitespace = true, charset (utf-8 is valid UTF-8 without a BOM; utf-8-bom is with a BOM). There is no guessing here: the bytes are either so or not. The files check.
  • EC-R03 (SHOULD, observe): indentation by indent_style (no tabs with space; no two or more spaces in an indent with tab) and lines not longer than max_line_length. It observes: multi-line strings, here-documents and continuation alignment give false findings. The indent check.

Globs are read by the specification: *, **, ?, [set], [!set], {a,b}, {1..9}; a glob without / applies to the file name in any folder. The value unset removes a property.

What is not checked

  • insert_final_newline = false (the standard says "make sure there is no newline", but editors almost never do this), indent_size and tab_width (the indent width breaks alignment), charset latin1 and utf-16.
  • Whether the .editorconfig rules themselves are good: for example, Markdown usually keeps trailing spaces (they are a line break), and .diff and .patch keep context spaces. The owner decides this in .editorconfig itself.

The package only reads files. It fixes nothing.