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

feat: kickoff repo #1

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Stop the editor from looking for .editorconfig files in the parent directories
# root = true

[*]
# Non-configurable Prettier behaviors
charset = utf-8
insert_final_newline = true
# Caveat: Prettier won’t trim trailing whitespace inside template strings, but your editor might.
# trim_trailing_whitespace = true

# Configurable Prettier behaviors
# (change these if your Prettier config differs)
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 100
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist
/coverage
/output
stats.html
.cache

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .nvmrc
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"endOfLine": "lf",
"printWidth": 100,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": true
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
}
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# eslint-config
ESLint config preset
# @empathyco/eslint-config

- [@antfu/eslint-config](https://github.com/antfu/eslint-config) as default ESLint config preset.
- [prettier](https://github.com/prettier/prettier) as code formatter sharing config preset.
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
- [@eslint/config-inspector](https://github.com/eslint/config-inspector) the visual tool for inspecting and understanding your ESLint flat configs.
- Requires ESLint v9.11.0+

## Usage

### Install

```bash
npm i -D prettier eslint @empathyco/eslint-config
davidglezz marked this conversation as resolved.
Show resolved Hide resolved
```

And create `eslint.config.mjs` in your project root:

```js
// eslint.config.mjs
import empathyco from '@empathyco/eslint-config';

export default empathyco();
```

### Add script for package.json

For example:

```json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:inspect": "eslint . --inspect-config",
"prettier": "prettier --write ."
Copy link
Contributor

@davidglezz davidglezz Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost all Motive fronted project has:

Suggested change
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:inspect": "eslint . --inspect-config",
"prettier": "prettier --write ."
"format": "prettier --write .",
"format-check": "prettier --check .",
"lint": "eslint . --fix",
"lint-check": "eslint ."

why format and not prettier?

We should not stick to a tool name, in the future we could use another tool like Biome.
That is why we have lint and not eslint.

Check vs Fix

There are 2 options,

  1. The short version lint only does checks and a long version lint:fix that fixes the issues.
  2. short version lint fixes and long version lint-check checks.

My proposal is, the short and quick/easy to write version, which is the one we usually use as developer, I would say with the fix included.
That is why I prefer option 2.

Also match with other scripts like typecheck or type-check

"lint:inspect": "eslint . --inspect-config",
It is useful, but only occasionally, I think it will not be used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with format instead of prettier.
I also refactored the script as you suggested, but with lint:check or format:check because it is as we use the scripts in every project.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"every project" → some

}
}
```
19 changes: 19 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import empathyco from './src';

export default empathyco(
{},
{
// Example
files: ['**/*.spec.{ts,tsx,js,jsx}'],
rules: {
'ts/explicit-function-return-type': 'off'
}
},
{
// Example
rules: {
// Disable extra stylistic rules that conflicts with prettier
'vue/singleline-html-element-content-newline': 'off'
}
}
);
Loading