init
This commit is contained in:
commit
d1ce6d3c3f
144
.gitignore
vendored
Normal file
144
.gitignore
vendored
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/node
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=node
|
||||||
|
|
||||||
|
### Node ###
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional stylelint cache
|
||||||
|
.stylelintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# vuepress v2.x temp and cache directory
|
||||||
|
.temp
|
||||||
|
|
||||||
|
# Docusaurus cache and generated files
|
||||||
|
.docusaurus
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
||||||
|
### Node Patch ###
|
||||||
|
# Serverless Webpack directories
|
||||||
|
.webpack/
|
||||||
|
|
||||||
|
# Optional stylelint cache
|
||||||
|
|
||||||
|
# SvelteKit build / generate output
|
||||||
|
.svelte-kit
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/node
|
||||||
46
index.js
Normal file
46
index.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2022,
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
extends: [
|
||||||
|
'canonical',
|
||||||
|
'plugin:sonarjs/recommended',
|
||||||
|
'eslint:recommended',
|
||||||
|
'next',
|
||||||
|
'prettier',
|
||||||
|
'turbo',
|
||||||
|
],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: ['canonical/typescript', 'canonical/zod'],
|
||||||
|
files: '*.ts',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react', 'canonical/jsx-a11y', 'canonical/typescript'],
|
||||||
|
files: '*.tsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/react', 'canonical/jsx-a11y'],
|
||||||
|
files: '*.jsx',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/json'],
|
||||||
|
files: '*.json',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['canonical/graphql'],
|
||||||
|
files: ['*.graphql'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||||
|
extends: ['plugin:testing-library/react', 'canonical/jest'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
plugins: ['canonical', 'sonarjs', '@typescript-eslint', 'prettier', 'testing-library'],
|
||||||
|
};
|
||||||
29
package.json
Normal file
29
package.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "eslint-config-custom",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"@typescript-eslint/parser": "^5.60.0",
|
||||||
|
"eslint": "^8.43.0",
|
||||||
|
"eslint-config-canonical": "^41.1.3",
|
||||||
|
"eslint-config-next": "^13.4.7",
|
||||||
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
"eslint-config-turbo": "^1.10.6",
|
||||||
|
"eslint-plugin-canonical": "^4.4.4",
|
||||||
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"eslint-plugin-sonarjs": "^0.19.0",
|
||||||
|
"eslint-plugin-testing-library": "^5.11.0"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"description": "Custom ESLint config for Next.js apps",
|
||||||
|
"repository": "https://github.com/vchikalkin/eslint-config-custom",
|
||||||
|
"author": "vchikalkin",
|
||||||
|
"keywords": [
|
||||||
|
"eslint",
|
||||||
|
"config",
|
||||||
|
"nextjs"
|
||||||
|
]
|
||||||
|
}
|
||||||
144
rules.js
Normal file
144
rules.js
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
// Disabled
|
||||||
|
'brace-style': 'off',
|
||||||
|
'@typescript-eslint/brace-style': 'off',
|
||||||
|
'comma-dangle': 'off',
|
||||||
|
'@typescript-eslint/comma-dangle': 'off',
|
||||||
|
'comma-spacing': 'off',
|
||||||
|
'@typescript-eslint/comma-spacing': 'off',
|
||||||
|
'func-call-spacing': 'off',
|
||||||
|
'@typescript-eslint/func-call-spacing': 'off',
|
||||||
|
indent: 'off',
|
||||||
|
'@typescript-eslint/indent': 'off',
|
||||||
|
'keyword-spacing': 'off',
|
||||||
|
'@typescript-eslint/keyword-spacing': 'off',
|
||||||
|
'lines-between-class-members': 'off',
|
||||||
|
'@typescript-eslint/lines-between-class-members': 'off',
|
||||||
|
'@typescript-eslint/member-delimiter-style': 'off',
|
||||||
|
'no-extra-parens': 'off',
|
||||||
|
'@typescript-eslint/no-extra-parens': 'off',
|
||||||
|
'object-curly-spacing': 'off',
|
||||||
|
'@typescript-eslint/object-curly-spacing': 'off',
|
||||||
|
'padding-line-between-statements': 'off',
|
||||||
|
'@typescript-eslint/padding-line-between-statements': 'off',
|
||||||
|
quotes: 'off',
|
||||||
|
'@typescript-eslint/quotes': 'off',
|
||||||
|
semi: 'off',
|
||||||
|
'@typescript-eslint/semi': 'off',
|
||||||
|
'space-before-blocks': 'off',
|
||||||
|
'@typescript-eslint/space-before-blocks': 'off',
|
||||||
|
'space-before-function-paren': 'off',
|
||||||
|
'@typescript-eslint/space-before-function-paren': 'off',
|
||||||
|
'space-infix-ops': 'off',
|
||||||
|
'@typescript-eslint/space-infix-ops': 'off',
|
||||||
|
'@typescript-eslint/type-annotation-spacing': 'off',
|
||||||
|
|
||||||
|
// Config
|
||||||
|
'linebreak-style': ['error', 'windows'],
|
||||||
|
'import/extensions': 'off',
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'newline-before-return': 'warn',
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'error',
|
||||||
|
'function-paren-newline': 'off',
|
||||||
|
'promise/prefer-await-to-then': 'off',
|
||||||
|
'@typescript-eslint/explicit-member-accessibility': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
accessibility: 'explicit',
|
||||||
|
overrides: {
|
||||||
|
constructors: 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'id-length': 'warn',
|
||||||
|
'import/no-unassigned-import': 'off',
|
||||||
|
'import/no-named-as-default-member': 'warn',
|
||||||
|
'react/jsx-sort-props': 'off',
|
||||||
|
'@typescript-eslint/naming-convention': 'warn',
|
||||||
|
|
||||||
|
// Unicorn
|
||||||
|
'unicorn/no-array-for-each': 'off',
|
||||||
|
'unicorn/prevent-abbreviations': 'off',
|
||||||
|
'unicorn/prefer-node-protocol': 'off',
|
||||||
|
'unicorn/no-array-reduce': 'off',
|
||||||
|
'unicorn/prefer-module': 'off',
|
||||||
|
'unicorn/text-encoding-identifier-case': 'off',
|
||||||
|
'unicorn/filename-case': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
case: 'kebabCase',
|
||||||
|
ignore: ['^.*.(jsx|tsx)$'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'unicorn/numeric-separators-style': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
onlyIfContainsSeparator: false,
|
||||||
|
hexadecimal: {
|
||||||
|
minimumDigits: 0,
|
||||||
|
groupLength: 2,
|
||||||
|
},
|
||||||
|
binary: {
|
||||||
|
minimumDigits: 0,
|
||||||
|
groupLength: 4,
|
||||||
|
},
|
||||||
|
octal: {
|
||||||
|
minimumDigits: 0,
|
||||||
|
groupLength: 4,
|
||||||
|
},
|
||||||
|
number: {
|
||||||
|
minimumDigits: 5,
|
||||||
|
groupLength: 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// Canonical
|
||||||
|
'canonical/prefer-inline-type-import': 'off',
|
||||||
|
'@babel/object-curly-spacing': ['off'],
|
||||||
|
'canonical/filename-match-exported': ['off'],
|
||||||
|
'canonical/import-specifier-newline': ['off'],
|
||||||
|
'canonical/destructuring-property-newline': ['off'],
|
||||||
|
'canonical/export-specifier-newline': 'off',
|
||||||
|
'canonical/sort-keys': [
|
||||||
|
'warn',
|
||||||
|
'asc',
|
||||||
|
{
|
||||||
|
natural: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'canonical/id-match': ['off'],
|
||||||
|
'import/order': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
groups: [],
|
||||||
|
'newlines-between': 'always',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
|
||||||
|
'react/function-component-definition': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
namedComponents: 'function-declaration',
|
||||||
|
unnamedComponents: 'arrow-function',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'arrow-body-style': [
|
||||||
|
'error',
|
||||||
|
'as-needed',
|
||||||
|
{
|
||||||
|
requireReturnForObjectLiteral: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// Sonar
|
||||||
|
'sonarjs/no-duplicate-string': 'warn',
|
||||||
|
|
||||||
|
// Zod
|
||||||
|
'zod/require-strict': 'off',
|
||||||
|
|
||||||
|
// Turbo
|
||||||
|
'turbo/no-undeclared-env-vars': 'warn',
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user