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

flat config #30

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 0 additions & 6 deletions .eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.husky
.vscode

eslint.config.js
.prettierrc
jsconfig.json
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"semi": false,
"bracketSpacing": true,
"quoteProps": "as-needed",
"trailingComma": "es5",
Expand Down
84 changes: 76 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,83 @@
{
"editor.formatOnSave": true,
"editor.rulers": [100, 120],
"editor.formatOnPaste": false,
"eslint.experimental.useFlatConfig": true,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.updateImportsOnFileMove.enabled": "always",
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true,
"**/*.code-search": true
},

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "always"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml"
],

"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"[css]": {
"editor.wordWrap": "off"
},
"[properties]": {
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll": "never"
},
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[yaml]": {
"editor.autoIndent": "advanced"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[dockercompose]": {
"editor.autoIndent": "advanced"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"files.associations": {
"[Jj]enkinsfile*": "groovy",
".env*": "properties"
}
}
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
# eslint-config-jwalker
Shareable ESLint config

Shareable ESLint config

## Install

```sh
npm i --save-dev eslint-config-jwalker
# flat config
npm i -D eslint-config-jwalker

# classic config
npm i -D eslint-config-jwalker@8
```

## Usage - Flat Config

```javascript
import tsParser from '@typescript-eslint/parser'
import dwEslintConfig from '@deepwaterv2/eslint-config'

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
...dwEslintConfig,
{ ignores: ['types/*', 'scripts/*', '**/*.d.ts'] },
{
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.eslint.json'],
},
},
},
]
```


Expand All @@ -20,11 +47,11 @@ Add this to your `.eslintrc` file (or `package.json`):

```json
{
"extends": "jwalker"
"extends": "jwalker"
}
```

*Note: We omitted the `eslint-config-` prefix since it is automatically assumed by ESLint.*
_Note: We omitted the `eslint-config-` prefix since it is automatically assumed by ESLint._

You can override settings from the shareable config by adding them directly into your
`.eslintrc` file.
2 changes: 2 additions & 0 deletions conf/common.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
Loading