Skip to content

Commit

Permalink
Merge pull request #3706 from udecode/feat/templates
Browse files Browse the repository at this point in the history
Feat/templates
  • Loading branch information
zbeyens committed Nov 1, 2024
1 parent 9864326 commit 8856588
Show file tree
Hide file tree
Showing 20 changed files with 851 additions and 818 deletions.
268 changes: 253 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,285 @@
const path = require('path');

const prettierConfig = require('./prettier.config.js');

module.exports = {
$schema: 'https://json.schemastore.org/eslintrc',
root: true,
extends: [
'next/core-web-vitals',
'prettier',
'plugin:tailwindcss/recommended',
'plugin:perfectionist/recommended-natural-legacy',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
},
],
plugins: ['tailwindcss', 'unused-imports', 'prettier'],
plugins: ['tailwindcss', 'unused-imports', 'perfectionist', 'prettier'],
root: true,
rules: {
'@next/next/no-html-link-for-pages': 'off',
'prettier/prettier': ['warn', { ...prettierConfig }],
'react/jsx-key': 'off',
'react/display-name': 'off',
'react/jsx-key': 'off',
'tailwindcss/classnames-order': 'warn',
'tailwindcss/no-custom-classname': 'error',
'tailwindcss/no-custom-classname': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{
args: 'none',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
vars: 'all',
varsIgnorePattern: '^_',
args: 'none',
argsIgnorePattern: '^_',
},
],
// Perfectionist
...{
'@typescript-eslint/adjacent-overload-signatures': 'off',

'perfectionist/sort-array-includes': [
'warn',
{
groupKind: 'literals-first',
ignoreCase: false,
type: 'natural',
},
],

'perfectionist/sort-astro-attributes': [
'warn',
{ ignoreCase: false, type: 'natural' },
],
'perfectionist/sort-classes': [
'warn',
{
groups: [
'index-signature',
'static-property',
'private-property',
'protected-property',
'property',
'constructor',
'static-method',
'private-method',
'protected-method',
'method',
['get-method', 'set-method'],
'static-block',
'unknown',
],
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-enums': [
'warn',
{
ignoreCase: false,
sortByValue: true,
type: 'natural',
},
],
'perfectionist/sort-exports': [
'warn',
{ ignoreCase: false, type: 'natural' },
],
'perfectionist/sort-imports': [
// 'off',
'warn',
{
customGroups: {
type: {
next: 'next',
react: 'react',
},
value: {
next: ['next'],
react: ['react', 'react-*'],
},
},
groups: [
'react',
['type', 'internal-type'],
'next',
['builtin', 'external'],
'internal',
['parent-type', 'sibling-type', 'index-type'],
['parent', 'sibling', 'index'],
'side-effect',
'style',
'object',
'unknown',
],
ignoreCase: false,
internalPattern: ['@/**'],
type: 'natural',
},
],
'perfectionist/sort-interfaces': [
'warn',
{
customGroups: {
key: ['key', 'keys'],
id: ['id', '_id'],
},
groupKind: 'required-first',
groups: ['key', 'id', 'multiline', 'unknown'],
ignoreCase: false,
type: 'natural',
},
],
// breaking: ordering matters
'perfectionist/sort-intersection-types': 'off',
'perfectionist/sort-jsx-props': [
'warn',
{
customGroups: {
key: ['key', 'keys'],
id: ['id', 'name', 'testId', 'data-testid'],
accessibility: [
'title',
'alt',
'placeholder',
'label',
'description',
'fallback',
],
callback: ['on*', 'handle*'],
className: ['className', 'class', 'style'],
control: ['asChild', 'as'],
data: ['data-*', 'aria-*'],
ref: ['ref', 'innerRef'],
state: [
'value',
'checked',
'selected',
'open',
'defaultValue',
'defaultChecked',
'defaultOpen',
'disabled',
'required',
'readOnly',
'loading',
],
variant: ['variant', 'size', 'orientation', 'color'],
},
groups: [
'id',
'key',
'ref',
'control',
'variant',
'className',
'state',
'callback',
'accessibility',
'data',
'unknown',
'shorthand',
],
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-maps': [
'warn',
{ ignoreCase: false, type: 'natural' },
],
'perfectionist/sort-named-exports': [
'warn',
{ groupKind: 'types-first', ignoreCase: false, type: 'natural' },
],
// 'perfectionist/sort-named-imports': ['off'],
'perfectionist/sort-named-imports': [
'warn',
{ groupKind: 'types-first', ignoreCase: false, type: 'natural' },
],
'perfectionist/sort-object-types': [
'warn',
{
customGroups: {
key: ['key', 'keys'],
id: ['id', '_id'],
callback: ['on*', 'handle*'],
},
groupKind: 'required-first',
groups: ['key', 'id', 'multiline', 'unknown', 'callback'],
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-objects': [
'warn',
{
customGroups: {
key: ['key', 'keys'],
id: ['id', '_id'],
callback: ['on*', 'handle*'],
},
groups: ['key', 'id', 'unknown', 'callback'],
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-sets': [
'warn',
{
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-switch-case': [
'warn',
{
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-union-types': [
'warn',
{
groups: [
'conditional',
'function',
'import',
['intersection', 'union'],
'named',
'operator',
'object',
'keyword',
'literal',
'tuple',
'nullish',
'unknown',
],
ignoreCase: false,
type: 'natural',
},
],
'perfectionist/sort-variable-declarations': [
'warn',
{
ignoreCase: false,
type: 'natural',
},
],
'react/jsx-sort-props': 'off',
'sort-imports': 'off',
'sort-keys': 'off',
},
},
settings: {
next: {
rootDir: ['./'],
},
tailwindcss: {
callees: ['cn', 'cva', 'withCn'],
config: path.join(__dirname, './tailwind.config.js'),
},
next: {
rootDir: ['./'],
},
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
},
],
};
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand All @@ -16,8 +16,9 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@udecode/cn": "^39.0.0",
"@udecode/plate-common": "39.2.20",
"@udecode/plate-selection": "39.2.12",
"@udecode/plate-common": "^39.2.21",
"@udecode/plate-basic-elements": "^39.0.0",
"@udecode/plate-basic-marks": "^39.0.0",
"class-variance-authority": "0.7.0",
"clsx": "^2.1.1",
"eslint-plugin-prettier": "^5.2.1",
Expand All @@ -36,7 +37,6 @@
"tailwindcss-animate": "1.0.7"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@types/node": "^22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
Expand All @@ -45,12 +45,14 @@
"encoding": "^0.1.13",
"eslint": "^8.56.0",
"eslint-config-next": "15.0.2",
"eslint-plugin-perfectionist": "3.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-tailwindcss": "^3.17.5",
"eslint-plugin-unused-imports": "^4.1.3",
"postcss": "^8.4.45",
"prettier": "^3.3.3",
"prettier-plugin-packagejson": "^2.5.3",
"tailwindcss": "^3.4.14",
"tsx": "^4.19.1",
"typescript": "5.6.3"
Expand All @@ -67,4 +69,4 @@
]
}
}
}
}
Loading

0 comments on commit 8856588

Please sign in to comment.