-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.editorconfig
86 lines (78 loc) · 3.42 KB
/
.editorconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
####################################################
# .editorconfig Configuration File
####################################################
# EditorConfig is awesome: https://EditorConfig.org
# This configuration enables consistent coding styles between various
# text editors and IDEs. By specifying formatting properties based
# on file types, it helps maintain a standard code style for teams
# or individual developers. The rules here act as a guide for
# better readability and maintainability of codebases.
####################################################
# GENERAL SETTINGS
####################################################
# Purpose:
# The root setting determines whether this is the top-level
# .editorconfig file in the directory hierarchy.
# - `root = true` specifies that this is the highest priority
# configuration file, and all other .editorconfig files in
# parent directories (if any) will be ignored.
root = true
####################################################
# JAVASCRIPT, JSX, TYPESCRIPT, TSX FILES
####################################################
# Purpose:
# Defines rules explicitly for JavaScript, JSX, TypeScript,
# and TSX files to enforce consistent formatting styles.
# Rules:
# - `charset = utf-8`: Ensures the character encoding for these
# files is universally UTF-8, avoiding issues with different encodings.
# - `indent_style = space`: Specifies that spaces, not tabs,
# should be used for indentation.
# - `indent_size = 4`: Sets the visual space equivalent to 4 spaces
# for each level of indentation.
# - `end_of_line = crlf`: Enforces the use of carriage return plus
# line feed (CRLF) as the newline character, commonly used in Windows.
# - `trim_trailing_whitespace = true`: Automatically removes all
# unnecessary whitespace at the end of a line.
# - `insert_final_newline = true`: Ensures every file ends with a
# single newline character, following POSIX standards.
# - `max_line_length = 80`: Specifies that every line should ideally
# not exceed 80 characters to enhance readability.
[*.{js,jsx,ts,tsx}]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
####################################################
# JSON FILES
####################################################
# Purpose:
# Rules specified here are tailored specifically to handle JSON data files.
# Because JSON has strict styling and formatting requirements, this
# section ensures that JSON files comply with common conventions.
# Rules:
# - `indent_style = space`: Spaces are used for indentation, as is
# standard in JSON formatting.
# - `indent_size = 2`: Each level of indentation consists of 2 spaces
# (commonly used for JSON for compactness).
# - `insert_final_newline = true`: Ensures each file ends with a
# newline for better compatibility across systems when reading files.
[*.json]
indent_style = space
indent_size = 2
insert_final_newline = true
####################################################
# MARKDOWN FILES
####################################################
# Purpose:
# Specifies formatting rules for markdown files (.md), used best
# for writing documentation or plain-text files.
# Rules:
# - `trim_trailing_whitespace = false`: Ensures that whitespace is
# preserved in Markdown files, as trailing whitespace can have
# semantic meaning (e.g., for line breaks in Markdown).
[*.md]
trim_trailing_whitespace = false