mirror of
https://github.com/enso-org/enso.git
synced 2024-11-21 16:36:59 +03:00
Edit prettier config (#10648)
This commit is contained in:
parent
46e8bab429
commit
4b96be8ef8
@ -5,12 +5,15 @@ overrides:
|
||||
- "*.m[j|t]s"
|
||||
- "*.c[j|t]s"
|
||||
options:
|
||||
printWidth: 100
|
||||
tabWidth: 4
|
||||
plugins: ["prettier-plugin-organize-imports"]
|
||||
semi: false
|
||||
tabWidth: 2
|
||||
singleQuote: true
|
||||
trailingComma: "es5"
|
||||
printWidth: 100
|
||||
trailingComma: "all"
|
||||
arrowParens: "avoid"
|
||||
organizeImportsSkipDestructiveCodeActions: true
|
||||
experimentalTernaries: true
|
||||
|
||||
- files: "*.md"
|
||||
options:
|
||||
|
@ -1,63 +0,0 @@
|
||||
/** @file Prettier configuration. */
|
||||
// @ts-check
|
||||
/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.[j|t]s', '*.[j|t]sx', '*.m[j|t]s', '*.c[j|t]s'],
|
||||
options: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||
printWidth: 100,
|
||||
tabWidth: 2,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
arrowParens: 'avoid',
|
||||
plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
|
||||
// This plugin's options
|
||||
importOrder: [
|
||||
'^react$',
|
||||
'',
|
||||
'<THIRD_PARTY_MODULES>',
|
||||
'',
|
||||
'^enso-',
|
||||
'',
|
||||
'^#[/]assets',
|
||||
'',
|
||||
'^#[/]App',
|
||||
'^#[/]appUtils',
|
||||
'^#[/]text',
|
||||
'^#[/]reactQueryClient',
|
||||
'',
|
||||
'^#[/]configurations[/]',
|
||||
'',
|
||||
'^#[/]data[/]',
|
||||
'',
|
||||
'^#[/]hooks[/]',
|
||||
'',
|
||||
'^#[/]providers[/]',
|
||||
'',
|
||||
'^#[/]events[/]',
|
||||
'',
|
||||
'^#[/]pages[/]',
|
||||
'',
|
||||
'^#[/]layouts[/]',
|
||||
'',
|
||||
'^#[/]components[/]',
|
||||
'',
|
||||
'^#[/]modals[/]',
|
||||
'',
|
||||
'^#[/]services[/]',
|
||||
'',
|
||||
'^#[/]utilities[/]',
|
||||
'',
|
||||
'^#[/]authentication[/]',
|
||||
'',
|
||||
'^[.]',
|
||||
],
|
||||
importOrderParserPlugins: ['typescript', 'jsx', 'importAssertions'],
|
||||
importOrderTypeScriptVersion: '5.0.0',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
11
app/dashboard/.prettierrc.json
Normal file
11
app/dashboard/.prettierrc.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/prettierrc",
|
||||
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"],
|
||||
"semi": false,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "all",
|
||||
"organizeImportsSkipDestructiveCodeActions": true,
|
||||
"experimentalTernaries": true
|
||||
}
|
@ -61,7 +61,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fast-check/vitest": "^0.0.8",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
|
||||
"@modyfi/vite-plugin-yaml": "^1.0.4",
|
||||
"@playwright/test": "^1.40.0",
|
||||
"@react-types/shared": "^3.22.1",
|
||||
@ -82,6 +81,7 @@
|
||||
"fast-check": "^3.15.0",
|
||||
"playwright": "^1.38.0",
|
||||
"postcss": "^8.4.29",
|
||||
"prettier-plugin-organize-imports": "^4.0.0",
|
||||
"prettier-plugin-tailwindcss": "^0.5.11",
|
||||
"react-toastify": "^9.1.3",
|
||||
"tailwindcss": "^3.4.1",
|
||||
|
@ -8,12 +8,12 @@ import * as url from 'node:url'
|
||||
// This is specialcased in other files, but these modules shouldn't be used in other files anyway.
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import eslintJs from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import tsEslint from '@typescript-eslint/eslint-plugin'
|
||||
import tsEslintParser from '@typescript-eslint/parser'
|
||||
import jsdoc from 'eslint-plugin-jsdoc'
|
||||
import react from 'eslint-plugin-react'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import tsEslint from '@typescript-eslint/eslint-plugin'
|
||||
import tsEslintParser from '@typescript-eslint/parser'
|
||||
import globals from 'globals'
|
||||
/* eslint-enable no-restricted-syntax */
|
||||
|
||||
// =================
|
||||
@ -32,7 +32,6 @@ const NAME = 'enso'
|
||||
* `node:process` is here because `process.on` does not exist on the namespace import. */
|
||||
const DEFAULT_IMPORT_ONLY_MODULES =
|
||||
'@vitejs\\u002Fplugin-react|node:process|chalk|string-length|yargs|yargs\\u002Fyargs|sharp|to-ico|connect|morgan|serve-static|tiny-invariant|clsx|create-servers|electron-is-dev|fast-glob|esbuild-plugin-.+|opener|tailwindcss.*|@modyfi\\u002Fvite-plugin-yaml|build-info|is-network-error|validator.+|.*[.]json$'
|
||||
const OUR_MODULES = 'enso-.*'
|
||||
const RELATIVE_MODULES =
|
||||
'bin\\u002Fproject-manager|bin\\u002Fserver|config\\u002Fparser|authentication|config|debug|detect|file-associations|index|ipc|log|naming|paths|preload|project-management|security|url-associations|content-config|desktop-environment|#\\u002F.*'
|
||||
const ALLOWED_DEFAULT_IMPORT_MODULES = `${DEFAULT_IMPORT_ONLY_MODULES}|postcss|ajv\\u002Fdist\\u002F2020|${RELATIVE_MODULES}`
|
||||
@ -147,29 +146,6 @@ const RESTRICTED_SYNTAXES = [
|
||||
selector: 'TSEnumDeclaration:not(:has(TSEnumMember))',
|
||||
message: 'Enums must not be empty',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'ImportDeclaration[source.value=/^(?!node:)/] ~ ImportDeclaration[source.value=/^node:/]',
|
||||
message:
|
||||
'Import node modules before npm modules, our modules, and relative imports, separated by a blank line',
|
||||
},
|
||||
{
|
||||
selector: `ImportDeclaration[source.value=/^(?:${OUR_MODULES}|${RELATIVE_MODULES})$/] ~ ImportDeclaration[source.value=/^(?!(|${OUR_MODULES}|${RELATIVE_MODULES})$|\\.)/]`,
|
||||
message:
|
||||
'Import npm modules before our modules and relative imports, separated by a blank line',
|
||||
},
|
||||
{
|
||||
selector: `ImportDeclaration[source.value=/^(?:${RELATIVE_MODULES})$/] ~ ImportDeclaration[source.value=/^(?:${OUR_MODULES})$/]`,
|
||||
message: 'Import our modules before relative imports, separated by a blank line',
|
||||
},
|
||||
{
|
||||
selector: `ImportDeclaration[source.value=/^\\./] ~ ImportDeclaration[source.value=/^[^.]/]`,
|
||||
message: 'Import relative imports last',
|
||||
},
|
||||
{
|
||||
selector: `ImportDeclaration[source.value=/^\\..+\\.(?:json|yml|yaml)$/] ~ ImportDeclaration[source.value=/^\\..+\\.(?!json|yml|yaml)[^.]+$/]`,
|
||||
message: 'Import data files after other relative imports',
|
||||
},
|
||||
{
|
||||
selector:
|
||||
'TSAsExpression:has(TSUnknownKeyword, TSNeverKeyword, TSAnyKeyword) > TSAsExpression',
|
||||
|
@ -4,7 +4,8 @@
|
||||
"eslint-plugin-react-hooks": "^4.6.2",
|
||||
"globals": "^15.8.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.3.2"
|
||||
"prettier": "^3.3.2",
|
||||
"prettier-plugin-organize-imports": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.3",
|
||||
|
@ -40,6 +40,9 @@ importers:
|
||||
prettier:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
prettier-plugin-organize-imports:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0(prettier@3.3.2)(typescript@5.5.3)(vue-tsc@2.0.24(typescript@5.5.3))
|
||||
|
||||
app/dashboard:
|
||||
dependencies:
|
||||
@ -140,9 +143,6 @@ importers:
|
||||
'@fast-check/vitest':
|
||||
specifier: ^0.0.8
|
||||
version: 0.0.8(vitest@1.6.0(@types/node@20.11.21)(jsdom@24.1.0)(lightningcss@1.25.1))
|
||||
'@ianvs/prettier-plugin-sort-imports':
|
||||
specifier: ^4.1.1
|
||||
version: 4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2)
|
||||
'@modyfi/vite-plugin-yaml':
|
||||
specifier: ^1.0.4
|
||||
version: 1.1.0(rollup@4.18.1)(vite@5.3.3(@types/node@20.11.21)(lightningcss@1.25.1))
|
||||
@ -203,9 +203,12 @@ importers:
|
||||
postcss:
|
||||
specifier: ^8.4.29
|
||||
version: 8.4.39
|
||||
prettier-plugin-organize-imports:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0(prettier@3.3.2)(typescript@5.5.3)(vue-tsc@2.0.24(typescript@5.5.3))
|
||||
prettier-plugin-tailwindcss:
|
||||
specifier: ^0.5.11
|
||||
version: 0.5.14(@ianvs/prettier-plugin-sort-imports@4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2))(prettier-plugin-organize-imports@4.0.0(prettier@3.3.2)(typescript@5.5.3))(prettier@3.3.2)
|
||||
version: 0.5.14(@ianvs/prettier-plugin-sort-imports@4.3.0(prettier@3.3.2))(prettier-plugin-organize-imports@4.0.0(prettier@3.3.2)(typescript@5.5.3)(vue-tsc@2.0.24(typescript@5.5.3)))(prettier@3.3.2)
|
||||
tailwindcss:
|
||||
specifier: ^3.4.1
|
||||
version: 3.4.4
|
||||
@ -8416,7 +8419,7 @@ snapshots:
|
||||
|
||||
'@humanwhocodes/object-schema@2.0.3': {}
|
||||
|
||||
'@ianvs/prettier-plugin-sort-imports@4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2)':
|
||||
'@ianvs/prettier-plugin-sort-imports@4.3.0(prettier@3.3.2)':
|
||||
dependencies:
|
||||
'@babel/core': 7.24.7
|
||||
'@babel/generator': 7.24.7
|
||||
@ -8425,10 +8428,9 @@ snapshots:
|
||||
'@babel/types': 7.24.7
|
||||
prettier: 3.3.2
|
||||
semver: 7.6.2
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.4.31
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
|
||||
'@internationalized/date@3.5.4':
|
||||
dependencies:
|
||||
@ -13727,11 +13729,11 @@ snapshots:
|
||||
optionalDependencies:
|
||||
vue-tsc: 2.0.24(typescript@5.5.3)
|
||||
|
||||
prettier-plugin-tailwindcss@0.5.14(@ianvs/prettier-plugin-sort-imports@4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2))(prettier-plugin-organize-imports@4.0.0(prettier@3.3.2)(typescript@5.5.3))(prettier@3.3.2):
|
||||
prettier-plugin-tailwindcss@0.5.14(@ianvs/prettier-plugin-sort-imports@4.3.0(prettier@3.3.2))(prettier-plugin-organize-imports@4.0.0(prettier@3.3.2)(typescript@5.5.3)(vue-tsc@2.0.24(typescript@5.5.3)))(prettier@3.3.2):
|
||||
dependencies:
|
||||
prettier: 3.3.2
|
||||
optionalDependencies:
|
||||
'@ianvs/prettier-plugin-sort-imports': 4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2)
|
||||
'@ianvs/prettier-plugin-sort-imports': 4.3.0(prettier@3.3.2)
|
||||
prettier-plugin-organize-imports: 4.0.0(prettier@3.3.2)(typescript@5.5.3)(vue-tsc@2.0.24(typescript@5.5.3))
|
||||
|
||||
prettier@3.3.2: {}
|
||||
|
Loading…
Reference in New Issue
Block a user