Skip to content

Commit

Permalink
fix(repo): convert entire workspace to use ES modules
Browse files Browse the repository at this point in the history
  • Loading branch information
MFarabi619 committed Aug 28, 2024
1 parent 2d2c3c4 commit 3c29cff
Show file tree
Hide file tree
Showing 21 changed files with 182 additions and 141 deletions.
58 changes: 33 additions & 25 deletions apps/docs-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
const { FlatCompat } = require('@eslint/eslintrc')
const js = require('@eslint/js')
const baseConfigPromise = require('../../eslint.config.js')
// TODO: merge with antfu eslint config
// const { FlatCompat } = require('@eslint/eslintrc');
import baseConfigPromise from '../../eslint.config.js'

module.exports = (async () => {
export default (async () => {
const baseConfig = await baseConfigPromise
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
})

return [
...baseConfig,
...compat.extends('plugin:playwright/recommended'),
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
rules: {},
},
{
files: ['src/**/*.{ts,js,tsx,jsx}'],
rules: {},
},
// ...compat.extends("plugin:playwright/recommended"),
// The following configurations are commented out
// ...compat.extends(
// 'plugin:@nx/react-typescript',
// 'next',
// 'next/core-web-vitals'
// ),
// {
// files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// rules: {
// '@next/next/no-html-link-for-pages': ['error', 'apps/portal/pages'],
// },
// },
// {
// files: ['**/*.ts', '**/*.tsx'],
// rules: {},
// },
// {
// files: ['**/*.js', '**/*.jsx'],
// rules: {},
// },
// ...compat.config({ env: { jest: true } }).map((config) => ({
// ...config,
// files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
// rules: {
// ...config.rules,
// },
// })),
// { ignores: ['.next/**/*'] },
]
})()
14 changes: 11 additions & 3 deletions apps/docs-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"target": "ESNext",
"moduleDetection": "force",
"module": "ESNext",
"allowJs": true,
"noUncheckedIndexedAccess": true,
"noEmit": true,
"outDir": "../../dist/out-tsc",
"sourceMap": false
"sourceMap": true,
"esModuleInterop": true,
"isolatedModules": true,
"skipLibCheck": true
},
"include": [
"**/*.ts",
Expand All @@ -14,6 +21,7 @@
"src/**/*.spec.js",
"src/**/*.test.ts",
"src/**/*.test.js",
"src/**/*.d.ts"
"src/**/*.d.ts",
"eslint.config.cjs"
]
}
5 changes: 3 additions & 2 deletions apps/docs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// TODO: merge with antfu eslint config
// const { FlatCompat } = require('@eslint/eslintrc');
const baseConfigPromise = require('../../eslint.config.js')
// const baseConfigPromise = require('../../eslint.config.js')
import baseConfigPromise from '../../eslint.config.js'
// const js = require('@eslint/js');

module.exports = (async () => {
export default (async () => {
const baseConfig = await baseConfigPromise

return [
Expand Down
File renamed without changes.
58 changes: 28 additions & 30 deletions apps/docs/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
// import type { Config } from 'tailwindcss'
// const { fontFamily } = require('tailwindcss/defaultTheme')
const { join } = require('node:path')
import { join } from 'node:path'

const { createPreset } = require('fumadocs-ui/tailwind-plugin')
import { createPreset } from 'fumadocs-ui/tailwind-plugin'

const { createGlobPatternsForDependencies } = require('@nx/react/tailwind')
import { createGlobPatternsForDependencies } from '@nx/react/tailwind'

/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ['class'],
content: [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}',
),
...createGlobPatternsForDependencies(__dirname),
'./mdx-components.tsx',
'../../node_modules/fumadocs-ui/dist/**/*.js',
],
theme: {
extend: {
fontFamily: {
// sans: ['var(--font-geist-sans)', ...fontFamily.sans],
},
export const darkMode = ['class']
export const content = [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}',
),
...createGlobPatternsForDependencies(__dirname),
'./mdx-components.tsx',
'../../node_modules/fumadocs-ui/dist/**/*.js',
]
export const theme = {
extend: {
fontFamily: {
// sans: ['var(--font-geist-sans)', ...fontFamily.sans],
},
},
presets: [
createPreset({
// preset: 'default',
// preset: 'neutral',
// preset: 'dusk',
// preset: 'purple',
// preset: 'ocean',
preset: 'catppuccin',
}),
],
plugins: [],
}
export const presets = [
createPreset({
// preset: 'default',
// preset: 'neutral',
// preset: 'dusk',
// preset: 'purple',
// preset: 'ocean',
preset: 'catppuccin',
}),
]
export const plugins = []
14 changes: 10 additions & 4 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"incremental": true,
"jsx": "preserve",
"resolveJsonModule": true,
"types": ["node"],
"types": [
"node"
],
"allowJs": true,
"strict": true,
"noEmit": true,
Expand All @@ -28,8 +30,12 @@
"next-env.d.ts",
".next/types/**/*.ts",
"next.config.mjs",
"postcss.config.js",
"tailwind.config.js"
"postcss.config.cjs",
"tailwind.config.cjs"
],
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"]
"exclude": [
"node_modules",
"**/*.spec.ts",
"**/*.test.ts"
]
}
58 changes: 33 additions & 25 deletions apps/portal-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
const { FlatCompat } = require('@eslint/eslintrc')
const js = require('@eslint/js')
const baseConfigPromise = require('../../eslint.config.js')
// TODO: merge with antfu eslint config
// const { FlatCompat } = require('@eslint/eslintrc');
import baseConfigPromise from '../../eslint.config.js'

module.exports = (async () => {
export default (async () => {
const baseConfig = await baseConfigPromise
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
})

return [
...baseConfig,
...compat.extends('plugin:playwright/recommended'),
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
rules: {},
},
{
files: ['src/**/*.{ts,js,tsx,jsx}'],
rules: {},
},
// ...compat.extends("plugin:playwright/recommended"),
// The following configurations are commented out
// ...compat.extends(
// 'plugin:@nx/react-typescript',
// 'next',
// 'next/core-web-vitals'
// ),
// {
// files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// rules: {
// '@next/next/no-html-link-for-pages': ['error', 'apps/portal/pages'],
// },
// },
// {
// files: ['**/*.ts', '**/*.tsx'],
// rules: {},
// },
// {
// files: ['**/*.js', '**/*.jsx'],
// rules: {},
// },
// ...compat.config({ env: { jest: true } }).map((config) => ({
// ...config,
// files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
// rules: {
// ...config.rules,
// },
// })),
// { ignores: ['.next/**/*'] },
]
})()
5 changes: 3 additions & 2 deletions apps/portal/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// TODO: merge with antfu eslint config
// const { FlatCompat } = require('@eslint/eslintrc');
const baseConfigPromise = require('../../eslint.config.js')
// const baseConfigPromise = require('../../eslint.config.js')
import baseConfigPromise from '../../eslint.config.js'
// const js = require('@eslint/js');

module.exports = (async () => {
export default (async () => {
const baseConfig = await baseConfigPromise

return [
Expand Down
4 changes: 2 additions & 2 deletions apps/portal/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { composePlugins, withNx } = require('@nx/next')
import { composePlugins, withNx } from '@nx/next'

/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
Expand All @@ -16,4 +16,4 @@ const plugins = [
withNx,
]

module.exports = composePlugins(...plugins)(nextConfig)
export default composePlugins(...plugins)(nextConfig)
File renamed without changes.
26 changes: 12 additions & 14 deletions apps/portal/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
const { join } = require('node:path')
const { createGlobPatternsForDependencies } = require('@nx/react/tailwind')
import { join } from 'node:path'
import { createGlobPatternsForDependencies } from '@nx/react/tailwind'

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}',
),
...createGlobPatternsForDependencies(__dirname),
],
theme: {
extend: {},
},
plugins: [],
export const content = [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}',
),
...createGlobPatternsForDependencies(__dirname),
]
export const theme = {
extend: {},
}
export const plugins = []
4 changes: 3 additions & 1 deletion apps/portal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"../../apps/portal/.next/types/**/*.ts",
"../../dist/apps/portal/.next/types/**/*.ts",
"next-env.d.ts",
".next/types/**/*.ts"
".next/types/**/*.ts",
"postcss.config.cjs",
"next.config.cjs"
],
"exclude": [
"node_modules",
Expand Down
Loading

0 comments on commit 3c29cff

Please sign in to comment.