Skip to content

Commit

Permalink
Update Prettier and VSCode settings, tsconfig, and app files
Browse files Browse the repository at this point in the history
  • Loading branch information
serifcolakel committed Feb 10, 2024
1 parent acc1a4c commit 539e78c
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 71 deletions.
56 changes: 18 additions & 38 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx", "react", "@typescript-eslint", "prettier", "simple-import-sort", "import"],
"plugins": [
"@nx",
"react",
"@typescript-eslint",
"prettier",
"simple-import-sort",
"import"
],
"extends": [
"airbnb",
"airbnb-typescript",
Expand All @@ -21,7 +28,7 @@
"import/no-extraneous-dependencies": "off",
"import/no-named-as-default": "off",
"react/react-in-jsx-scope": "off",
"linebreak-style": "off",
"linebreak-style": "error",
"react/jsx-props-no-spreading": "off",
"no-console": "error",
"no-var": "error",
Expand Down Expand Up @@ -139,7 +146,15 @@
{
"groups": [
// Packages `react` related packages come first.
["^@nx", "^react", "^\\w", "^@hookform", "^@radix-ui", "^@tanstack", "@testing-library"],
[
"^@nx",
"^react",
"^\\w",
"^@hookform",
"^@radix-ui",
"^@tanstack",
"@testing-library"
],
// npm packages
// Anything that starts with a letter (or digit or underscore), or `@` followed by a letter.
// ["^\\w"],
Expand Down Expand Up @@ -169,41 +184,6 @@
}
]
}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
7 changes: 6 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"singleQuote": true
"tabWidth": 2,
"semi": true,
"printWidth": 80,
"trailingComma": "all",
"singleQuote": true,
"useTabs": false
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"activityBar.background": "#2B3106",
"titleBar.activeBackground": "#3C4408",
"titleBar.activeForeground": "#F9FCE5"
}
},
"editor.formatOnSave": true
}
4 changes: 2 additions & 2 deletions apps/container/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export default {
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
'^.+\\.[tj]sx?$': [ 'babel-jest', { presets: [ '@nx/react/babel' ] } ],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleFileExtensions: [ 'ts', 'tsx', 'js', 'jsx' ],
coverageDirectory: '../../coverage/apps/container',
};
6 changes: 2 additions & 4 deletions apps/container/module-federation.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ const config: ModuleFederationConfig = {
* declare module 'my-external-remote';
*
*/
remotes: [
['genel-muhasebe', 'http://localhost:3005/remoteEntry.js']
],
remotes: [],
exposes: {
'./App': 'apps/container/src/app/app',
},
};
};

export default config;
8 changes: 0 additions & 8 deletions apps/container/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@
"buildTarget": "container:build:production"
}
}
},
"typecheck": {
"executor": "nx:run-commands",
"options": {
"commands": ["tsc -p tsconfig.app.json --noEmit"],
"cwd": "apps/container",
"forwardAllArgs": false
}
}
},
"tags": []
Expand Down
4 changes: 2 additions & 2 deletions apps/container/src/app/app.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('App', () => {
const { baseElement } = render(
<BrowserRouter>
<App />
</BrowserRouter>
</BrowserRouter>,
);

expect(baseElement).toBeTruthy();
Expand All @@ -19,7 +19,7 @@ describe('App', () => {
const { getByText } = render(
<BrowserRouter>
<App />
</BrowserRouter>
</BrowserRouter>,
);

expect(getByText(/Welcome container/gi)).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion apps/container/src/app/nx-welcome.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable react/no-danger */
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
Expand All @@ -7,7 +8,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
export function NxWelcome({ title }: { title: string }) {

return (
<>
<style
Expand Down
4 changes: 2 additions & 2 deletions apps/container/src/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { BrowserRouter } from 'react-router-dom';
import App from './app/app';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
document.getElementById('root') as HTMLElement,
);

root.render(
<StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>
</StrictMode>,
);
8 changes: 4 additions & 4 deletions apps/container/webpack.config.prod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withReact } from '@nx/react';
import { withModuleFederation } from '@nx/react/module-federation';
import { composePlugins, ModuleFederationConfig,withNx } from '@nx/webpack';
import { composePlugins, ModuleFederationConfig, withNx } from '@nx/webpack';

import baseConfig from './module-federation.config';

Expand All @@ -24,13 +24,13 @@ const prodConfig: ModuleFederationConfig = {
* ]
*/
remotes: [
['genel-muhasebe', 'http://localhost:3005/remoteEntry.js']
]
[ 'genel-muhasebe', 'http://localhost:3005/remoteEntry.js' ],
],
};

// Nx plugins for webpack to build config object from Nx options and context.
export default composePlugins(
withNx(),
withReact(),
withModuleFederation(prodConfig)
withModuleFederation(prodConfig),
);
6 changes: 3 additions & 3 deletions apps/container/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withReact } from '@nx/react';
import { withModuleFederation } from '@nx/react/module-federation';
import { composePlugins, ModuleFederationConfig,withNx } from '@nx/webpack';
import { composePlugins, ModuleFederationConfig, withNx } from '@nx/webpack';

import baseConfig from './module-federation.config';

Expand All @@ -14,6 +14,6 @@ export default composePlugins(
withReact(),
withModuleFederation(config),
(oldConfig) => ({
...oldConfig,
})
...oldConfig,
}),
);
6 changes: 1 addition & 5 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
"jsx": "react",
"downlevelIteration": true,
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": ".",
"paths": {
"genel-muhasebe/Module": ["apps/genel-muhasebe/src/remote-entry.ts"]
Expand Down

0 comments on commit 539e78c

Please sign in to comment.