Skip to content

Commit

Permalink
Configured eslint-plugin-n 🤪
Browse files Browse the repository at this point in the history
  • Loading branch information
01taylop committed Aug 2, 2024
1 parent 97126f1 commit 9c9fd08
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 15 deletions.
14 changes: 9 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# TODO

## ESLint Plugins
## ESLint Rules

- [ ] [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
- [ ] [eslint](https://github.com/eslint/eslint/tree/main)
- [x] [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments)
- [ ] [eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql)
- [ ] [eslint-plugin-i18next](https://github.com/edvardchen/eslint-plugin-i18next)
- [ ] [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
- [x] [eslint-plugin-inclusive-language](https://github.com/muenzpraeger/eslint-plugin-inclusive-language)
- [x] [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
- [x] [eslint-plugin-jest-formatting](https://github.com/dangreenisrael/eslint-plugin-jest-formatting)
- [ ] [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json)
- [ ] [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
- [ ] [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node)
- [x] [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)
- [x] [eslint-plugin-promise](https://github.com/eslint-community/eslint-plugin-promise)
- [ ] [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
- [ ] [eslint-plugin-security](https://github.com/eslint-community/eslint-plugin-security)
Expand All @@ -23,7 +22,12 @@
- [ ] [eslint-stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
- [ ] [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)

## Stylelint Plugins
### Other interesting plugins

- [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
- [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json)

## Stylelint Rules

- [ ] stylelint-config-property-sort-order-smacss
- [ ] stylelint-config-standard-scss
Expand Down
2 changes: 2 additions & 0 deletions config/eslint/build-flat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const buildFlatConfig = () => ([{
plugins: {
'eslint-comments': Plugins.EslintComments,
'inclusive-language': Plugins.InclusiveLanguage,
'n': Plugins.N,
'promise': Plugins.Promise,
'sort-destructure-keys': Plugins.SortDestructureKeys,
'sort-exports': Plugins.SortExports,
},
rules: {
...Rules.ESLintComments,
...Rules.InclusiveLanguage,
...Rules.N,
...Rules.Promise,
...Rules.SortDestructureKeys,
...Rules.SortExports,
Expand Down
2 changes: 2 additions & 0 deletions config/eslint/build-legacy-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const buildLegacyConfig = () => ({
plugins: [
'eslint-comments',
'inclusive-language',
'n',
'promise',
'sort-destructure-keys',
'sort-exports',
],
rules: {
...Rules.ESLintComments,
...Rules.InclusiveLanguage,
...Rules.N,
...Rules.Promise,
...Rules.SortDestructureKeys,
...Rules.SortExports,
Expand Down
12 changes: 6 additions & 6 deletions config/eslint/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const FILE_PATHS = {
TESTS: [
'*.spec.*',
'*.test.*',
'**/*.spec.*',
'**/*.test.*',
],
TESTS_TYPESCRIPT: [
'*.spec.ts',
'*.spec.tsx',
'*.test.ts',
'*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.test.ts',
'**/*.test.tsx',
]
}

Expand Down
2 changes: 2 additions & 0 deletions config/eslint/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import InclusiveLanguage from 'eslint-plugin-inclusive-language'
import Jest from 'eslint-plugin-jest'
import JestFormatting from 'eslint-plugin-jest-formatting'
import Promise from 'eslint-plugin-promise'
import N from 'eslint-plugin-n'
import SortDestructureKeys from 'eslint-plugin-sort-destructure-keys'
import SortExports from 'eslint-plugin-sort-exports'

Expand All @@ -13,6 +14,7 @@ const Plugins = {
InclusiveLanguage,
Jest,
JestFormatting,
N,
Promise,
SortDestructureKeys,
SortExports,
Expand Down
2 changes: 2 additions & 0 deletions config/eslint/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ESLintComments from './eslint-comments'
import InclusiveLanguage from './inclusive-language'
import { Jest, JestTypescript } from './jest'
import JestFormatting from './jest-formatting'
import N from './n'
import Promise from './promise'
import SortDestructureKeys from './sort-destructure-keys'
import SortExports from './sort-exports'
Expand All @@ -12,6 +13,7 @@ const Rules = {
Jest,
JestFormatting,
JestTypescript,
N,
Promise,
SortDestructureKeys,
SortExports,
Expand Down
42 changes: 42 additions & 0 deletions config/eslint/rules/n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// https://github.com/eslint-community/eslint-plugin-n

export default {
'callback-return': 1,
'exports-style': 0,
'file-extension-in-import': 0,
'global-require': 0,
'handle-callback-err': 0,
'hashbang': 2,
'no-callback-literal': 0,
'no-deprecated-api': 2,
'no-exports-assign': 2,
'no-extraneous-import': 0,
'no-extraneous-require': 0,
'no-missing-import': 0,
'no-missing-require': 0,
'no-mixed-requires': [2, { allowCall: true, grouping: true }],
'no-new-require': 2,
'no-path-concat': 2,
'no-process-env': 0,
'no-process-exit': 0, // TODO: Revisit this rule
'no-restricted-import': 0,
'no-restricted-require': 0,
'no-sync': 0,
'no-unpublished-bin': 2,
'no-unpublished-import': 0,
'no-unpublished-require': 0,
'no-unsupported-features/es-builtins': 2,
'no-unsupported-features/es-syntax': 2,
'no-unsupported-features/node-builtins': 2,
'prefer-global/buffer': 2,
'prefer-global/console': 2,
'prefer-global/process': 2,
'prefer-global/text-decoder': 2,
'prefer-global/text-encoder': 2,
'prefer-global/url': 2,
'prefer-global/url-search-params': 2,
'prefer-node-protocol': 2,
'prefer-promises/dns': 2,
'prefer-promises/fs': 2,
'process-exit-as-throw': 0,
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"eslint-plugin-inclusive-language": "2.2.1",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-jest-formatting": "3.1.0",
"eslint-plugin-n": "17.10.1",
"eslint-plugin-promise": "6.4.0",
"eslint-plugin-sort-destructure-keys": "2.0.0",
"eslint-plugin-sort-exports": "0.9.1",
Expand Down Expand Up @@ -69,6 +70,7 @@
"eslint-plugin-inclusive-language",
"eslint-plugin-jest",
"eslint-plugin-jest-formatting",
"eslint-plugin-n",
"eslint-plugin-promise",
"eslint-plugin-sort-destructure-keys",
"eslint-plugin-sort-exports",
Expand Down
63 changes: 59 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@
resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c"
integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==

"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
Expand Down Expand Up @@ -2427,6 +2427,14 @@ emoji-regex@^9.2.2:
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==

enhanced-resolve@^5.17.0:
version "5.17.1"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15"
integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==
dependencies:
graceful-fs "^4.2.4"
tapable "^2.2.0"

entities@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
Expand Down Expand Up @@ -2498,6 +2506,22 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==

eslint-compat-utils@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/eslint-compat-utils/-/eslint-compat-utils-0.5.1.tgz#7fc92b776d185a70c4070d03fd26fde3d59652e4"
integrity sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==
dependencies:
semver "^7.5.4"

eslint-plugin-es-x@^7.5.0:
version "7.8.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz#a207aa08da37a7923f2a9599e6d3eb73f3f92b74"
integrity sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==
dependencies:
"@eslint-community/eslint-utils" "^4.1.2"
"@eslint-community/regexpp" "^4.11.0"
eslint-compat-utils "^0.5.1"

[email protected]:
version "3.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.2.0.tgz#9e1cd7b4413526abb313933071d7aba05ca12ffa"
Expand Down Expand Up @@ -2525,6 +2549,20 @@ [email protected]:
dependencies:
"@typescript-eslint/utils" "^6.0.0 || ^7.0.0"

[email protected]:
version "17.10.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-17.10.1.tgz#da2a3fd1a41c9d901bbc06b8c4d4d5916e012913"
integrity sha512-hm/q37W6efDptJXdwirsm6A257iY6ZNtpoSG0wEzFzjJ3AhL7OhEIhdSR2e4OdYfHO5EDeqlCfFrjf9q208IPw==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
enhanced-resolve "^5.17.0"
eslint-plugin-es-x "^7.5.0"
get-tsconfig "^4.7.0"
globals "^15.8.0"
ignore "^5.2.4"
minimatch "^9.0.5"
semver "^7.5.3"

[email protected]:
version "6.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.4.0.tgz#54926d53c79541efe9cea6ac1d823a58bbed1106"
Expand Down Expand Up @@ -2831,6 +2869,13 @@ get-stream@^6.0.0:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==

get-tsconfig@^4.7.0:
version "4.7.6"
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.6.tgz#118fd5b7b9bae234cc7705a00cd771d7eb65d62a"
integrity sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==
dependencies:
resolve-pkg-maps "^1.0.0"

get-tsconfig@^4.7.5:
version "4.7.5"
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.5.tgz#5e012498579e9a6947511ed0cd403272c7acbbaf"
Expand Down Expand Up @@ -2901,6 +2946,11 @@ globals@^14.0.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e"
integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==

globals@^15.8.0:
version "15.9.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-15.9.0.tgz#e9de01771091ffbc37db5714dab484f9f69ff399"
integrity sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==

globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
Expand All @@ -2918,7 +2968,7 @@ globjoin@^0.1.4:
resolved "https://registry.yarnpkg.com/globjoin/-/globjoin-0.1.4.tgz#2f4494ac8919e3767c5cbb691e9f463324285d43"
integrity sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==

graceful-fs@^4.2.9:
graceful-fs@^4.2.4, graceful-fs@^4.2.9:
version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
Expand Down Expand Up @@ -2965,7 +3015,7 @@ humps@^2.0.1:
resolved "https://registry.yarnpkg.com/humps/-/humps-2.0.1.tgz#dd02ea6081bd0568dc5d073184463957ba9ef9aa"
integrity sha512-E0eIbrFWUhwfXJmsbdjRQFQPrl5pTEoKlz163j1mTqqUnU9PgR4AgB8AIITzuB3vLBdxZXyZ9TDIrwB2OASz4g==

ignore@^5.0.5, ignore@^5.2.0, ignore@^5.3.1:
ignore@^5.0.5, ignore@^5.2.0, ignore@^5.2.4, ignore@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==
Expand Down Expand Up @@ -3843,7 +3893,7 @@ minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
dependencies:
brace-expansion "^1.1.7"

minimatch@^9.0.3:
minimatch@^9.0.3, minimatch@^9.0.5:
version "9.0.5"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
Expand Down Expand Up @@ -4567,6 +4617,11 @@ table@^6.8.2:
string-width "^4.2.3"
strip-ansi "^6.0.1"

tapable@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==

terser@^5.0.0:
version "5.31.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.1.tgz#735de3c987dd671e95190e6b98cfe2f07f3cf0d4"
Expand Down

0 comments on commit 9c9fd08

Please sign in to comment.