Skip to content

Commit

Permalink
feat: update eslint config (#22)
Browse files Browse the repository at this point in the history
* feat: update eslint config

* chore: update renovate config
  • Loading branch information
Nr9 authored Jun 30, 2023
1 parent 10c1601 commit 399c63a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ const project = new javascript.NodeProject({
renovatebotOptions: {
overrideConfig: {
packageRules: [
{
matchPackagePatterns: ['.*'],
groupName: 'dependencies',
},
{
matchUpdateTypes: ['patch', 'minor'],
groupName: 'dependencies (non-major)',
},
{
matchManagers: ['github-actions'],
groupName: 'GitHub Actions Dependencies',
},
],
},
},
Expand Down
1 change: 1 addition & 0 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'./rules/node',
'./rules/airbnb-overrides',
'./rules/restricted-imports',
'./rules/import-sort',
'./rules/prettier',
].map(require.resolve),
}
1 change: 1 addition & 0 deletions react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'./rules/react',
'./rules/airbnb-overrides',
'./rules/restricted-imports',
'./rules/import-sort',
'./rules/prettier',
].map(require.resolve),

Expand Down
12 changes: 12 additions & 0 deletions renovate.json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rules/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module.exports = {
{
extends: ['plugin:import/typescript', 'airbnb-typescript/base'],
files: ['*.ts', '*.tsx'],
rules: {},
rules: {
'import/no-duplicates': ['error', { 'prefer-inline': true }],
},
},
{
files: ['.eslintrc.js'],
Expand Down
31 changes: 31 additions & 0 deletions rules/import-sort.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
plugins: ['simple-import-sort', 'import'],

rules: {
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Node.js builtins prefixed with `node:`.
['^node:'],
['^react'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
['^'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Style imports.
['^.+\\.?(css)$'],
],
},
],
},
}
2 changes: 2 additions & 0 deletions rules/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ module.exports = {

// https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/
'@typescript-eslint/consistent-type-imports': 'error',

'@typescript-eslint/restrict-template-expressions': ['error', { allowNullish: true }],
},

overrides: [
Expand Down

0 comments on commit 399c63a

Please # to comment.