Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
//"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
'plugin:mdx/recommended'
],

"overrides": [
{
files: '**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'prettier'
],
plugins: ['import', 'unicorn'],
rules: {
'prefer-object-has-own': 'error',
'logical-assignment-operators': [
'error',
'always',
{ enforceForIfStatements: true }
],
'@typescript-eslint/prefer-optional-chain': 'error',
'no-else-return': ['error', { allowElseIf: false }],
'no-lonely-if': 'error',
'prefer-destructuring': [
'error',
{ VariableDeclarator: { object: true } }
],
'import/no-duplicates': 'error',
'no-negated-condition': 'off',
'unicorn/no-negated-condition': 'error',
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'object-shorthand': ['error', 'always'],
// todo: enable
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off'
}
},
{
files: '{pages}/**',
excludedFiles: ['*.md', '*.mdx'],
extends: [
'plugin:mdx/recommended',
// 'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:@next/next/recommended'
],
rules: {
'react/prop-types': 'off',
"no-unused-expressions": "off",
'react/no-unknown-property': ['error', { ignore: ['jsx'] }],
'react-hooks/exhaustive-deps': 'error',
'react/self-closing-comp': 'error',
'no-restricted-syntax': [
'error',
{
// ❌ useMemo(…, [])
selector:
'CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]',
message:
"`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
},
{
// ❌ z.object(…)
selector:
'MemberExpression[object.name=z] > .property[name=object]',
message: 'Use z.strictObject is more safe.'
}
],
'react/jsx-filename-extension': [
'error',
{ extensions: ['.tsx', '.jsx'], allow: 'as-needed' }
],
'react/jsx-curly-brace-presence': 'error',
'react/jsx-boolean-value': 'error'

},
settings: {
react: { version: 'detect' }
}
},
],
//"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest"
},
"plugins": [
"react",
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}
30 changes: 30 additions & 0 deletions .github/workflows/eslint-mdx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: eslint-mdx
on:
- push
- pull_request
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 19.8.1
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm i
- name: eslint global install
run: npm install -g eslint
- name: eslint install
run: npm install eslint --save-dev
- name: eslint-config-prettier install
run: npm install --save-dev eslint-config-prettier
- name: check eslint
run: eslint 'pages/**/*.mdx'
48 changes: 48 additions & 0 deletions .github/workflows/html-proofer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: html-proofer
on:
- push
- pull_request


jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [19.8.1]

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run:
npm i
- name: npm run build
run:
npm run build

- uses: anishathalye/proof-html@v2
with:
directory: "./.next"
enforce_https: false
max_concurrency: 50
# HTTP connection timeout
connect_timeout: 30
# HTTP request timeout
timeout: 120
tokens: |
{"https://github.com": "${{ secrets.SUNGITTOKEN }}"}
ignore_url: |
https://github.com
https://en.wikipedia.org/wiki/Main_Page
ignore_url_re: |
^https://twitter.com/
swap_urls: |
{"^https://www.anishathalye.com/": "/"}
Loading