Skip to content

Commit

Permalink
Refactor researcher app to use ECMAScript modules (ESM)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarah committed Feb 27, 2024
1 parent 0cd88bc commit 9e1688e
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 24 deletions.
2 changes: 1 addition & 1 deletion apps/dataset-browser/tailwind.config.js
@@ -1,4 +1,4 @@
const sharedConfig = require('tailwind-config/tailwind.config.js');
const sharedConfig = require('tailwind-config/tailwind.config.ts');

module.exports = {
presets: [sharedConfig],
Expand Down
4 changes: 0 additions & 4 deletions apps/researcher/.eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions apps/researcher/.eslintrc.json
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["custom"]
}
@@ -1,13 +1,13 @@
const nextJest = require('next/jest');
import nextJest from 'next/jest';
import type {Config} from 'jest';

const createJestConfig = nextJest();

/** @type {import('jest').Config} */
const customJestConfig = {
const customJestConfig: Config = {
testTimeout: 60000,
testMatch: ['**/*.test.ts(x)?'],
collectCoverage: true,
setupFiles: ['<rootDir>/jest.setup.js'],
setupFiles: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
Expand All @@ -27,7 +27,7 @@ const customJestConfig = {
* @link https://github.com/vercel/next.js/issues/36077#issuecomment-1096635363
*/

module.exports = async () => ({
module.exports = async (): Promise<Config> => ({
...(await createJestConfig(customJestConfig)()),

transformIgnorePatterns: ['node_modules/(?!(next-intl)/)'],
Expand Down
@@ -1,4 +1,4 @@
const {loadEnvConfig} = require('@next/env');
import {loadEnvConfig} from '@next/env';

// Make sure the environment variables for testing are loaded in the same way Next handles these
module.exports = async () => {
Expand Down
1 change: 1 addition & 0 deletions apps/researcher/package.json
Expand Up @@ -2,6 +2,7 @@
"name": "researcher",
"version": "1.0.0",
"private": true,
"type": "module",
"files": [],
"engines": {
"node": "18.x"
Expand Down
@@ -1,6 +1,8 @@
module.exports = {
const config = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

export default config;
5 changes: 0 additions & 5 deletions apps/researcher/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions apps/researcher/tailwind.config.ts
@@ -0,0 +1,7 @@
import sharedConfig from 'tailwind-config/tailwind.config';

const config = {
presets: [sharedConfig],
};

export default config;
39 changes: 38 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/tailwind-config/package.json
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@tailwindcss/aspect-ratio": "0.4.2",
"@tailwindcss/forms": "0.5.6",
"@tailwindcss/typography": "0.5.10"
"@tailwindcss/typography": "0.5.10",
"tailwindcss": "3.4.1"
}
}
@@ -1,12 +1,13 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
import type {Config} from 'tailwindcss';

const config = {
content: [
'src/**/*.{js,ts,jsx,tsx}',
'../../packages/ui/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
typography: theme => ({
typography: (theme: (color: string) => string) => ({
DEFAULT: {
css: {
color: theme('colors.gray.900'),
Expand Down Expand Up @@ -87,4 +88,6 @@ module.exports = {
require('@tailwindcss/typography'),
require('@tailwindcss/aspect-ratio'),
],
};
} satisfies Config;

export default config;
2 changes: 1 addition & 1 deletion packages/ui/tailwind.config.js
@@ -1,4 +1,4 @@
const sharedConfig = require('tailwind-config/tailwind.config.js');
const sharedConfig = require('tailwind-config/tailwind.config.ts');

module.exports = {
presets: [sharedConfig],
Expand Down

0 comments on commit 9e1688e

Please sign in to comment.