Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editor config #52

Open
2 tasks done
timondev opened this issue Feb 17, 2023 · 2 comments
Open
2 tasks done

Add editor config #52

timondev opened this issue Feb 17, 2023 · 2 comments

Comments

@timondev
Copy link

Describe the problem

I would like to have a .editorconfig file as to the recommendation from: https://editorconfig.org/

This is needed since not everyone will be using vscode

Describe the proposed solution

I would like to see a .editorconfig file in the form of, updated to the needs of this project:

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

Have you checked if this issue has already been raised?

  • I did not find any similar issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@w3cj
Copy link
Member

w3cj commented Feb 24, 2023

I think .editorconfig will potentially have too many conflicts with eslint+prettier and will need to be maintained separately.

If you want to work on this to show an example of what the config will look like, I'm happy to take a look, but do note, we don't want editorconfig conflicting with eslint/prettier.

@rsromanowski
Copy link

Stealing some setup instructions from this blog post:

ESLint + Prettier

Install the eslint-config-prettier package from NPM,

npm install eslint-config-prettier --save-dev

This package disabled all ESLint rules that overlap with Prettier, so to enable the prettier rules, add "prettier" to the end of the extends array inside .eslintrc.js file...

extends: ['airbnb-base', 'prettier'],

Now, we should be all good! Prettier should work together with ESLint to enforce coding standards and formatting rules at the same time.

and

While Prettier mostly takes care of code formatting, EditorConfig can enforce additional restrictions on a developer's editor. In some cases, Prettier can also use EditorConfig configurations to auto-format our code as well if, (1) .prettierrc file is not provided and (2) the Prettier VSCode extension is already installed.

This is my first foray into a typescript project, but there seems to be some compatibility with some config

Here's another post that seems to cover a lot of the same setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants