-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from eduzz/support-flat-config
Support flat config
- Loading branch information
Showing
14 changed files
with
1,203 additions
and
2,283 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @danieloprado @ffernandomoraes @JonathasRodrigues | ||
* @danieloprado @ffernandomoraes @JonathasRodrigues @caferrari @henriquegomes6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
module.exports = { | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"quoteProps": "consistent", | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"bracketSpacing": true, | ||
"bracketSameLine": false, | ||
"arrowParens": "avoid", | ||
"endOfLine": "lf", | ||
"printWidth": 120, | ||
"semi": true | ||
} | ||
singleQuote: true, | ||
jsxSingleQuote: true, | ||
quoteProps: 'consistent', | ||
trailingComma: 'none', | ||
useTabs: false, | ||
tabWidth: 2, | ||
bracketSpacing: true, | ||
bracketSameLine: false, | ||
arrowParens: 'avoid', | ||
endOfLine: 'auto', | ||
printWidth: 120, | ||
semi: true, | ||
plugins: ['prettier-plugin-tailwindcss'], | ||
tailwindFunctions: ['tw', 'clsx'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,58 @@ | ||
module.exports = { | ||
extends: ['plugin:@typescript-eslint/recommended'], | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
caughtErrorsIgnorePattern: '^_' | ||
} | ||
], | ||
'@typescript-eslint/adjacent-overload-signatures': ['error'], | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
leadingUnderscore: 'allowSingleOrDouble' | ||
}, | ||
{ | ||
selector: 'parameter', | ||
format: ['camelCase', 'PascalCase'], | ||
leadingUnderscore: 'allow' | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
modifiers: ['private'], | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allowSingleOrDouble' | ||
}, | ||
{ | ||
selector: 'typeLike', | ||
format: ['camelCase', 'PascalCase'] | ||
} | ||
], | ||
'@typescript-eslint/member-ordering': ['error'], | ||
'@typescript-eslint/no-namespace': ['error'], | ||
'@typescript-eslint/no-require-imports': ['error'], | ||
'@typescript-eslint/no-object-literal-type-assertion': 'off', | ||
'@typescript-eslint/no-useless-constructor': 'error', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': ['error', { overrides: { constructors: 'no-public' } }] | ||
const pluginImport = require('eslint-plugin-import'); | ||
const tseslint = require('typescript-eslint'); | ||
|
||
/** @type import('eslint').Linter.FlatConfig */ | ||
module.exports = [ | ||
...tseslint.configs.recommended.map(config => ({ ...config, files: ['**/*.ts', '**/*.tsx'] })), | ||
{ | ||
name: '@eduzz/eslint-config-typescript', | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: { | ||
...pluginImport.configs.typescript.rules, | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
caughtErrorsIgnorePattern: '^_' | ||
} | ||
], | ||
'@typescript-eslint/adjacent-overload-signatures': ['error'], | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
leadingUnderscore: 'allowSingleOrDouble' | ||
}, | ||
{ | ||
selector: 'parameter', | ||
format: ['camelCase', 'PascalCase'], | ||
leadingUnderscore: 'allow' | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
modifiers: ['private'], | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allowSingleOrDouble' | ||
}, | ||
{ | ||
selector: 'typeLike', | ||
format: ['camelCase', 'PascalCase'] | ||
} | ||
], | ||
'@typescript-eslint/member-ordering': ['error'], | ||
'@typescript-eslint/no-namespace': ['error'], | ||
'@typescript-eslint/no-require-imports': ['error'], | ||
'@typescript-eslint/no-object-literal-type-assertion': 'off', | ||
'@typescript-eslint/no-useless-constructor': 'error', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': ['error', { overrides: { constructors: 'no-public' } }] | ||
} | ||
} | ||
}; | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./configs/default'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const childProcess = require('child_process'); | ||
const fs = require('node:fs'); | ||
|
||
const parse = require('parse-gitignore'); | ||
|
||
module.exports = function gitignore(...extra) { | ||
const files = childProcess | ||
.execSync('git ls-files *.gitignore') | ||
.toString() | ||
.split('\n') | ||
.filter(file => !!file); | ||
|
||
const ignores = []; | ||
|
||
for (const file of files) { | ||
let content = ''; | ||
|
||
try { | ||
content = fs.readFileSync(file, 'utf8'); | ||
} catch (error) { | ||
continue; | ||
} | ||
|
||
const parsed = parse(`${content}\n`); | ||
const globs = parsed.globs(); | ||
console.log(JSON.stringify(globs, null, 2)); | ||
|
||
for (const glob of globs) { | ||
if (glob.type === 'ignore') ignores.push(...glob.patterns); | ||
else if (glob.type === 'unignore') ignores.push(...glob.patterns.map(pattern => `!${pattern}`)); | ||
} | ||
} | ||
|
||
return [...ignores, ...extra]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
const configDefault = require('./configs/default'); | ||
const configTypescript = require('./configs/typescript'); | ||
const ignores = require('./ignores'); | ||
|
||
module.exports = { | ||
extends: ['./configs/default', './configs/typescript'], | ||
env: { node: true } | ||
ignores, | ||
/** @type import('eslint').Linter.FlatConfig[] */ | ||
configs: [configDefault, ...configTypescript] | ||
}; |
Oops, something went wrong.