Skip to content

Commit

Permalink
test: migrate to jest
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Mar 12, 2024
1 parent 97c24ce commit d3cdec7
Show file tree
Hide file tree
Showing 363 changed files with 13,818 additions and 9,505 deletions.
14 changes: 7 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
root = true
root=true

[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
charset=utf-8
trim_trailing_whitespace=true
insert_final_newline=true
indent_style=space
indent_size=2
end_of_line=lf
225 changes: 0 additions & 225 deletions .eslintrc

This file was deleted.

68 changes: 68 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
root: true,
plugins: ['eslint-plugin', 'import-x'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin/recommended',
'plugin:import-x/recommended',
'plugin:prettier/recommended',
],
env: {
node: true,
es6: true,
es2017: true,
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
},
rules: {
'@typescript-eslint/no-var-requires': 'off',

'eslint-plugin/consistent-output': ['error', 'always'],
'eslint-plugin/meta-property-ordering': 'error',
'eslint-plugin/no-deprecated-context-methods': 'error',
'eslint-plugin/no-deprecated-report-api': 'off',
'eslint-plugin/prefer-replace-text': 'error',
'eslint-plugin/report-message-format': 'error',
'eslint-plugin/require-meta-docs-description': [
'error',
{ pattern: '^(Enforce|Ensure|Prefer|Forbid).+\\.$' },
],
'eslint-plugin/require-meta-schema': 'error',
'eslint-plugin/require-meta-type': 'error',

// dog fooding
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: ['test/**'],
optionalDependencies: false,
peerDependencies: true,
bundledDependencies: false,
},
],
'import-x/unambiguous': 'off',
},

settings: {
'import-x/resolver': {
node: {
paths: ['src'],
},
},
},

overrides: [
{
files: 'test/**',
env: {
jest: true,
},
rules: {
'import-x/default': 0,
},
},
],
}
14 changes: 14 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import baseConfig from '@1stg/prettier-config'

export default {
...baseConfig,
overrides: [
...baseConfig.overrides,
{
files: ['**/*.js'],
options: {
parser: 'babel-flow',
},
},
],
}
32 changes: 16 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~

When opening an [issue](#issues):

- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue
- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue

[PR](#prs) time:

- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log
- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log

Remember, you don't need to do it all yourself; any of these are helpful! 😎

## How to get started

If you are new to `eslint`, below are a few resources that will help you to familiarize yourself with the project.

- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).
- Watch [this presentation](https://www.youtube.com/watch?v=2W9tUnALrLg) to learn the fundamental concept of Abstract Syntax Trees (AST) and the way `eslint` works under the hood.
- Familiarize yourself with the [AST explorer](https://astexplorer.net/) tool. Look into rules in `docs/rules`, create patterns in the rules, then analyze its AST.
- Explore the blog posts on how to create a custom rule. [One blog post](https://blog.yonatan.dev/writing-a-custom-eslint-rule-to-spot-undeclared-props/). [Second blog post](https://betterprogramming.pub/creating-custom-eslint-rules-cdc579694608).
- Read the official `eslint` [developer guide](https://eslint.org/docs/latest/developer-guide/architecture/).

## Issues

### Search open + closed issues for similar cases

You may find an open issue that closely matches what you are thinking. You may also find a closed issue with discussion that either solves your problem or explains why we are unlikely to solve it in the near future.
You may find an open issue that closely matches what you are thinking. You may also find a closed issue with discussion that either solves your problem or explains why we are unlikely to solve it in the near future.

If you find a matching issue that is open, and marked `accepted` and/or `help wanted`, you might want to [open a PR](#prs).
If you find a matching issue that is open, and marked `accepted` and/or `help wanted`, you might want to [open a PR](#prs).

### Open an issue

Let's discuss your issue. Could be as simple as unclear documentation or a wonky config file.
If you're suggesting a feature, it might exist and need better documentation, or it might be in process. Even given those, some discussion might be warranted to ensure the enhancement is clear.
Let's discuss your issue. Could be as simple as unclear documentation or a wonky config file.
If you're suggesting a feature, it might exist and need better documentation, or it might be in process. Even given those, some discussion might be warranted to ensure the enhancement is clear.

You're welcome to jump right to a PR, but without a discussion, can't make any guarantees about merging.
You're welcome to jump right to a PR, but without a discussion, can't make any guarantees about merging.

That said: sometimes seeing the code makes the discussion clearer.😄
That said: sometimes seeing the code makes the discussion clearer.😄

This is a helpful contribution all by itself. Thanks!

Expand Down
Loading

0 comments on commit d3cdec7

Please sign in to comment.