Skip to content

Commit

Permalink
refactor: upgrade forwarded source
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed May 28, 2023
1 parent 764312e commit 73849be
Show file tree
Hide file tree
Showing 202 changed files with 46,682 additions and 30,623 deletions.
238 changes: 168 additions & 70 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,174 @@
const debug = require('debug')(`${require('./package.json').name}:eslint-config`);
const restrictedGlobals = require('confusing-browser-globals');

const plugins = ['unicorn', '@typescript-eslint', 'import'];

const xtends = [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:unicorn/recommended',
'plugin:@next/next/recommended'
];

const environment = {
es2022: true,
node: true
// * Instead of including more options here, enable them on a per-file basis
};

const rules = {
'no-console': 'warn',
'no-return-await': 'warn',
'no-await-in-loop': 'warn',
'import/no-unresolved': ['error', { commonjs: true }],
'no-restricted-globals': ['warn'].concat(restrictedGlobals),
'no-extra-boolean-cast': 'off',
'no-empty': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: true, ignoreIIFE: true }
],
'@typescript-eslint/ban-ts-comment': [
'warn',
{
'ts-expect-error': 'allow-with-description',
minimumDescriptionLength: 6
}
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_+',
varsIgnorePattern: '^_+',
caughtErrorsIgnorePattern: '^ignored?\\d*$',
caughtErrors: 'all'
}
],
// ? Ever since v4, we will rely on TypeScript to catch these
'no-undef': 'off',
'@typescript-eslint/no-var-requires': 'off',
// ? I'll be good, I promise
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' }
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: true }
],
'no-unused-vars': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/no-keyword-prefix': 'off',
'unicorn/prefer-string-replace-all': 'warn',
// ? Handled by integration tests
'unicorn/prefer-module': 'off',
// ? I am of the opinion that there is a difference between something being
// ? defined as nothing and something being undefined
'unicorn/no-null': 'off',
// ? Ensure files have the correct case... except for a few
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
ignore: ['next__bundle-analyzer.d.ts']
}
],
// ? If MongoDB can get away with "DB" in its name, so can we. Also,
// ? unnecessary underscores are a big no-no.
'unicorn/prevent-abbreviations': [
'warn',
{
checkFilenames: false,
replacements: {
args: false,
str: false,
fn: false,
db: false,
dir: false,
dist: false,
tmp: false,
pkg: false,
src: false,
dest: false,
obj: false,
val: false,
env: false,
temp: false,
req: false,
res: false,
prop: false,
props: false,
params: false,
lib: false,
param: false,
num: false
},
ignore: [/stderr/i]
}
],
// ? Actually, I rather like this curt syntax
'unicorn/no-await-expression-member': 'off',
// ? Between disabling this and disabling no-empty-function, I choose this
'unicorn/no-useless-undefined': 'off',
// ? Not sure why this isn't the default
'unicorn/prefer-export-from': ['warn', { ignoreUsedVariables: true }],
// ? Yeah, I read The Good Parts too, I know what I'm doing
'unicorn/consistent-function-scoping': 'off',
// ? It's 2022. Use Prettier
'unicorn/no-nested-ternary': 'off',
// ? `Array.from` communicates intent much better than `[...]`
'unicorn/prefer-spread': 'off',
// ? Not realistic when using TypeScript
'unicorn/prefer-native-coercion-functions': 'off',
// ? Premature optimization is evil
'unicorn/no-array-for-each': 'off',
// ? Lol, no
'unicorn/explicit-length-check': 'off',
// ? I don't think so
'unicorn/no-negated-condition': 'off',
// ? This is not it, chief (Prettier prevails)
'unicorn/number-literal-case': 'off',
// ? I'll decide when I want switch cases for fallthrough or not, thanks
'unicorn/prefer-switch': 'off'
};

module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['jest', 'jest-dom', '@typescript-eslint', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@next/next/recommended'
],
plugins,
extends: xtends,
parserOptions: {
ecmaVersion: 8,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
impliedStrict: true,
experimentalObjectRestSpread: true,
jsx: true
},
project: 'tsconfig.eslint.json'
},
env: {
es6: true,
node: true,
jest: true,
'jest/globals': true,
browser: true,
webextensions: true
},
rules: {
'no-console': 'warn',
'no-return-await': 'warn',
'no-await-in-loop': 'warn',
'import/no-unresolved': [
'error',
{
commonjs: true
}
],
'no-restricted-globals': ['warn'].concat(restrictedGlobals),
'no-extra-boolean-cast': 'off',
'no-empty': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: true, ignoreIIFE: true }
],
'@typescript-eslint/ban-ts-comment': [
'warn',
{
'ts-expect-error': 'allow-with-description',
minimumDescriptionLength: 6
}
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_+',
varsIgnorePattern: '^_+',
caughtErrorsIgnorePattern: '^ignored?\\d*$',
caughtErrors: 'all'
}
],
// ? Ever since v4, we will rely on TypeScript to catch these
'no-undef': 'off',
'@typescript-eslint/no-var-requires': 'off',
'no-unused-vars': 'off',
// ? Broken as of next 12.0.7
'@next/next/no-page-custom-font': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
},
env: environment,
rules,
overrides: [
{
files: ['*.test.*'],
plugins: [...plugins, 'jest'],
env: { ...environment, jest: true },
extends: [
...xtends,
'plugin:jest/all',
'plugin:jest/style',
'plugin:jest-dom/recommended'
],
rules: {
...rules,
'jest/lowercase': 'off',
'jest/consistent-test-it': 'off',
'jest/require-top-level-describe': 'off',
Expand All @@ -100,10 +184,13 @@ module.exports = {
'jest/no-commented-out-tests': 'warn',
'jest/require-hook': 'off',
'jest/no-alias-methods': 'off',
'jest/max-expects': 'off',
'jest/prefer-mock-promise-shorthand': 'off',
'jest/no-conditional-in-test': 'off',
'jest/no-conditional-expect': 'off',
'jest/max-expects': 'off',
'jest/prefer-mock-promise-shorthand': 'off'
'jest/prefer-each': 'off',
'jest/prefer-snapshot-hint': 'off',
'jest/no-untyped-mock-factory': 'warn'
}
}
],
Expand All @@ -114,10 +201,11 @@ module.exports = {
'import/extensions': ['.ts', '.tsx', '.js', '.jsx'],
// ? Switch parsers depending on which type of file we're looking at
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
'babel-eslint': ['.js', '.jsx']
'@typescript-eslint/parser': ['.ts', '.tsx', '.cts', '.mts'],
'@babel/eslint-parser': ['.js', '.jsx', '.cjs', '.mjs']
},
'import/resolver': {
node: {},
alias: {
map: [
// ! If changed, also update these aliases in tsconfig.json,
Expand Down Expand Up @@ -145,7 +233,17 @@ module.exports = {
'.*/bin/.*'
]
},
ignorePatterns: ['coverage', 'dist', 'bin', 'build', '/next.config.js'],
ignorePatterns: [
'coverage',
'dist',
'fixtures',
'__fixtures__',
'__snapshots__',
'test/integration/assets',
'bin',
'build',
'/next.config.js'
],
globals: {
page: true,
browser: true,
Expand Down
22 changes: 11 additions & 11 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ personal appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
- Using welcoming and inclusive language.
- Being respectful of differing viewpoints and experiences.
- Gracefully accepting constructive criticism.
- Focusing on what is best for the community.
- Showing empathy towards other community members.

Examples of unacceptable behavior by participants include:

- Racism or sexism in any shape or form
- Racism or sexism in any shape or form.
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
advances.
- Trolling, insulting/derogatory comments, and personal or political attacks.
- Public or private harassment.
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
address, without explicit permission.
- Other conduct which could reasonably be considered inappropriate in a
professional setting
professional setting.

## Our Responsibilities

Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ reproduce the problem on our side, how can we ever hope to fix it for you 🤷
If your issue is simple enough that it doesn't warrant a demo repo, include
instead the simplest most basic possible steps to reproduce your problem; e.g.:
1. Clone the dummy repo I made based on the docs example: https://github.com/...
1. Clone the dummy repo I made: https://github.com/
2. Run `npm install`
3. Run `npx jest`
4. See error "xyz" at test 2, which shouldn't be happening
Expand All @@ -42,7 +42,7 @@ description of what you expected to happen if not included above. If applicable,
add screenshots and code samples to help explain the problem.
</details>
-->
|-->

<!--
<details><summary><strong>Suggested solution</strong></summary>
Expand All @@ -52,7 +52,7 @@ proposal of how your issue might be solved, including any unnoted workarounds.
If applicable, add code samples and screenshots.
</details>
-->
|-->

<!--
<details><summary><strong>Additional context</strong></summary>
Expand All @@ -66,7 +66,7 @@ runtime details, lengthy error logs, assets links, or what have you; e.g.:
- Babel: yes, version 8.1.0
- TypeScript: yes, version 5.2.0
- Browser: firefox 171, chrome 190
- List of installed packages: https://github.com/.../main/package.json
- List of installed packages: https://github.com//main/package.json
Relevant log lines:
```
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ about: Tell us about your awesome idea
labels: enhancement
---

<!-- THANK YOU for taking a moment to improve this project. 🤘🏿 You rock! 🎸 -->
<!-- THANK YOU for taking a moment to improve this project. 🤘🏿 You rock! 🎸 |-->

<!--
Replace this comment with a clear and concise description of what you're
Expand All @@ -13,7 +13,7 @@ links, etc.
🚩 If you encountered a bug, please report it as a bug instead of a feature
request.
-->
|-->

<!--
<details><summary><strong>Alternatives and workarounds</strong></summary>
Expand Down
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!-- Add a brief description of your PR here -->
<!-- Add a brief description of your PR here |-->

<!-- If this PR closes any issues, please enumerate them; i.e. "Closes #4" -->
<!-- If this PR closes any issues, please enumerate them; i.e. "Closes #4" |-->

<!-- If this PR involves or references any other issues, list them as well -->

---

<!-- Replace `[ ]` with `[x]` in all the following boxes that apply to you -->

- [ ] I have read **[CONTRIBUTING.md][1]**
- [ ] This PR is not security related (see [SECURITY.md][2])
- [ ] I have read **[CONTRIBUTING.md][1]**.
- [ ] This PR is not security related (see [SECURITY.md][2]).

[1]: /CONTRIBUTING.md
[2]: /SECURITY.md
Loading

0 comments on commit 73849be

Please sign in to comment.