Skip to content

Commit

Permalink
linter & formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Sep 29, 2023
1 parent e91fb28 commit ec1fe23
Show file tree
Hide file tree
Showing 13 changed files with 6,242 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[*.{md}]
trim_trailing_whitespace = false
[*.{md,mdx}]
trim_trailing_whitespace = false
33 changes: 33 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# build output
dist/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
.eslintcache
bun.*

.astro

functions/*.js

_

.dev.vars
yarn-error.log
out
dev-dist
pnpm-lock.yaml
.vercel
133 changes: 133 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: true,
},
env: { node: true, browser: true },
reportUnusedDisableDirectives: true,
extends: [
'eslint:recommended',
'plugin:unicorn/all',
'plugin:@typescript-eslint/recommended',
'plugin:jsonc/prettier',
'plugin:astro/recommended',
'prettier',
],
plugins: ['@typescript-eslint', 'prettier'],
overrides: [
{
files: ['*.ts', '*.d.ts'],
rules: {
'@typescript-eslint/no-namespace': ['off'],
},
},
{
files: ['*.mdx', '*.md'],
extends: 'plugin:mdx/recommended',
rules: {
'@typescript-eslint/no-unused-vars': ['off'],
'no-unused-vars': ['off'],
'mdx/no-unused-expressions': ['off'],
},
settings: {
'mdx/code-blocks': true,
'mdx/language-mapper': {},
},
},
{
files: ['*.js', '*.cjs', '*.mjs'],
/**
* These rules apply to code blocks in MDX files.
*/
rules: {
'no-unused-vars': ['off'],
'@typescript-eslint/no-unused-vars': ['warn'],
'no-undef': ['off'],
},
},
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
rules: {},
},
],
rules: {
'unicorn/no-keyword-prefix': ['error', { disallowedPrefixes: ['new', 'for'] }],
'unicorn/filename-case': ['off'],
'unicorn/prefer-module': ['off'],
'unicorn/no-array-reduce': ['off'],
'unicorn/consistent-function-scoping': ['off', { checkArrowFunctions: false }],
'unicorn/prefer-top-level-await': ['off'],
'unicorn/prefer-event-target': ['off'],
'unicorn/prevent-abbreviations': [
'error',
{
allowList: {
ProcessEnv: true,
ImportMetaEnv: true,
Props: true,
Env: true,
},
checkFilenames: false,
},
],
'import/no-anonymous-default-export': ['off'],
'no-unused-vars': ['off'],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'array-element-newline': ['error', 'consistent'],
'object-curly-spacing': ['error', 'always'],
'prettier/prettier': [
'warn',
{},
{
usePrettierrc: true,
fileInfoOptions: {
withNodeModules: true,
},
},
],
'no-mixed-operators': ['off'],
'no-multiple-empty-lines': ['off'],
'no-unexpected-multiline': ['off'],
'@typescript-eslint/triple-slash-reference': ['off'],
'@typescript-eslint/no-var-requires': ['off'],
'@typescript-eslint/prefer-namespace-keyword': ['off'],
'@typescript-eslint/no-empty-interface': ['off'],
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/ban-ts-comment': ['off'],
'@typescript-eslint/ban-types': [
'warn',
{
types: {
String: {
message: 'Use string instead',
fixWith: 'string',
},

'{}': false,
},
},
],
},
}
23 changes: 23 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/** @type {import('prettier').Config} */
module.exports = {
semi: false,
tabWidth: 2,
printWidth: 100,
endOfLine: 'auto',
singleQuote: true,
proseWrap: 'never',
jsxSingleQuote: true,
arrowParens: 'avoid',
trailingComma: 'es5',
singleAttributePerLine: true,
plugins: [require.resolve('prettier-plugin-astro')],
overrides: [
{
files: '*.mdx',
options: {
useTabs: false,
tabWidth: 2,
},
},
],
}
27 changes: 27 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,33 @@
"source.fixAll.eslint": true
},
"eslint.enable": true,
"eslint.format.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"astro",
"json",
"jsonc",
"markdown",
"mdx"
],
"eslint.options": {
"extensions": [
".js",
".cjs",
".mjs",
".ts",
".cts",
".mts",
".jsx",
".tsx",
".md",
".astro",
".mdx"
]
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
58 changes: 29 additions & 29 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
import tailwind from "@astrojs/tailwind";
import starlight from "@astrojs/starlight";
import expressiveCode from "astro-expressive-code";
import vercelAdapter from "@astrojs/vercel/serverless";
import { defineConfig, passthroughImageService } from "astro/config";
import tailwind from '@astrojs/tailwind'
import starlight from '@astrojs/starlight'
import expressiveCode from 'astro-expressive-code'
import vercelAdapter from '@astrojs/vercel/serverless'
import { defineConfig, passthroughImageService } from 'astro/config'

// https://astro.build/config
export default defineConfig({
site: "https://docs.ethfollow.xyz",
output: "hybrid",
site: 'https://docs.ethfollow.xyz',
output: 'hybrid',
adapter: vercelAdapter({ webAnalytics: { enabled: true } }),
integrations: [
expressiveCode({
theme: "dracula-soft",
theme: 'dracula-soft',
}),
starlight({
title: "EFP",
description: "Ethereum Follow Protocol",
favicon: "/favicon.ico",
defaultLocale: "en",
title: 'EFP',
description: 'Ethereum Follow Protocol',
favicon: '/favicon.ico',
defaultLocale: 'en',
lastUpdated: true,
locales: {
root: {
label: "English",
lang: "en-US",
label: 'English',
lang: 'en-US',
},
},
logo: {
src: "./src/assets/logo.png",
src: './src/assets/logo.png',
},
social: {
github: "https://github.com/ethereumfollowprotocol",
twitter: "https://twitter.com/ethfollowpr",
github: 'https://github.com/ethereumfollowprotocol',
twitter: 'https://twitter.com/ethfollowpr',
},
sidebar: [
{
label: "Design Specification",
link: "/spec",
label: 'Design Specification',
link: '/spec',
},
],
customCss: [
"./src/styles/custom.css",
"./src/styles/tailwind.css",
"@fontsource/inter/400.css",
"@fontsource/inter/700.css",
"@fontsource/ibm-plex-serif/400.css",
"@fontsource/ibm-plex-serif/600.css",
"@fontsource/ibm-plex-mono/400.css",
"@fontsource/ibm-plex-mono/600.css",
'./src/styles/custom.css',
'./src/styles/tailwind.css',
'@fontsource/inter/400.css',
'@fontsource/inter/700.css',
'@fontsource/ibm-plex-serif/400.css',
'@fontsource/ibm-plex-serif/600.css',
'@fontsource/ibm-plex-mono/400.css',
'@fontsource/ibm-plex-mono/600.css',
],
}),
tailwind({
applyBaseStyles: false,
configFile: "./tailwind.config.ts",
configFile: './tailwind.config.ts',
}),
],
image: {
service: passthroughImageService(),
},
});
})
Binary file removed bun.lockb
Binary file not shown.
26 changes: 23 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "docs",
"description": "Ethereum Follow Protocol Documentation",
"type": "module",
"version": "0.0.1",
"homepage": "https://docs.ethfollow.xyz",
Expand All @@ -8,7 +9,11 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"lint": "eslint --fix . --ext='js,cjs,mjs,jsx,ts,tsx,astro,md,mdx,json' --cache",
"format": "prettier --write . --ignore-path='.eslintignore' --ignore-unknown --cache",
"typecheck": "tsc --project tsconfig.json --noEmit",
"clean": "rm -rf .astro dist node_modules bun.lockb"
},
"dependencies": {
"@astrojs/starlight": "^0.10.2",
Expand All @@ -18,7 +23,7 @@
"@fontsource/ibm-plex-serif": "^5.0.8",
"@fontsource/inter": "^5.0.8",
"@vercel/analytics": "^1.0.2",
"astro": "^3.1.4",
"astro": "^3.2.0",
"astro-expressive-code": "^0.26.1",
"expressive-code": "^0.26.1",
"hast-util-to-html": "^9.0.0"
Expand All @@ -27,8 +32,23 @@
"@astrojs/starlight-tailwind": "^2.0.0",
"@astrojs/tailwind": "^5.0.0",
"@total-typescript/ts-reset": "^0.5.1",
"@types/eslint": "^8.44.3",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"bun-types": "^1.0.3",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.0",
"eslint-plugin-jsonc": "^2.9.0",
"eslint-plugin-mdx": "^2.2.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^48.0.1",
"hastscript": "^8.0.0",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0",
"sharp": "^0.32.6",
"tailwindcss": "^3.3.3"
"tailwindcss": "^3.3.3",
"typed-query-selector": "^2.11.0",
"typescript": "^5.2.2"
}
}
Loading

0 comments on commit ec1fe23

Please sign in to comment.