Skip to content

Commit

Permalink
chore: update deps and migrate ESLint config
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Oct 7, 2024
1 parent 88c5420 commit 9dad882
Show file tree
Hide file tree
Showing 38 changed files with 1,649 additions and 1,490 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

107 changes: 0 additions & 107 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ testem.log
Thumbs.db

.nx/cache
.nx/workspace-data
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/coverage
/.nx/cache
CHANGELOG.md

/.nx/workspace-data
76 changes: 76 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});

module.exports = [
{ plugins: { '@nx': nxEslintPlugin } },
...compat
.config({ plugins: ['unused-imports', 'simple-import-sort'] })
.map((config) => ({
...config,
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
...config.rules,
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
banTransitiveDependencies: true,
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
'no-duplicate-imports': 'error',
'no-empty': 'error',
'no-fallthrough': 'error',
'no-param-reassign': 'error',
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-var': 'error',
'prefer-const': 'error',
'no-return-await': 'error',
'require-await': 'error',
'require-yield': 'error',
'simple-import-sort/imports': [
'error',
{ groups: [['^\\u0000'], ['^@?\\w'], ['^'], ['^\\.']] },
],
'simple-import-sort/exports': 'error',
},
})),
...compat.config({ extends: ['plugin:@nx/typescript'] }).map((config) => ({
...config,
files: ['**/*.ts', '**/*.tsx'],
rules: {
...config.rules,
'@typescript-eslint/no-extra-semi': 'error',
'no-extra-semi': 'off',
},
})),
...compat.config({ extends: ['plugin:@nx/javascript'] }).map((config) => ({
...config,
files: ['**/*.js', '**/*.jsx'],
rules: {
...config.rules,
'@typescript-eslint/no-extra-semi': 'error',
'no-extra-semi': 'off',
},
})),
...compat.config({ env: { jest: true } }).map((config) => ({
...config,
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
rules: {
...config.rules,
},
})),
];
8 changes: 4 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getJestProjects } from '@nx/jest';
import { getJestProjectsAsync } from '@nx/jest';

export default {
projects: getJestProjects(),
};
export default async () => ({
projects: await getJestProjectsAsync(),
});
51 changes: 51 additions & 0 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"migrations": [
{
"cli": "nx",
"version": "19.2.0-beta.2",
"description": "Updates the default workspace data directory to .nx/workspace-data",
"implementation": "./src/migrations/update-19-2-0/move-workspace-data-directory",
"package": "nx",
"name": "19-2-0-move-graph-cache-directory"
},
{
"cli": "nx",
"version": "19.2.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-17-3-0/update-nxw",
"package": "nx",
"name": "19-2-2-update-nx-wrapper"
},
{
"version": "19.2.4-beta.0",
"description": "Set project name in nx.json explicitly",
"implementation": "./src/migrations/update-19-2-4/set-project-name",
"x-repair-skip": true,
"package": "nx",
"name": "19-2-4-set-project-name"
},
{
"version": "20.0.0-beta.7",
"description": "Migration for v20.0.0-beta.7",
"implementation": "./src/migrations/update-20-0-0/move-use-daemon-process",
"package": "nx",
"name": "move-use-daemon-process"
},
{
"cli": "nx",
"version": "19.1.0-beta.6",
"description": "Migrate no-extra-semi rules into user config, out of nx extendable configs",
"implementation": "./src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi",
"package": "@nx/eslint-plugin",
"name": "update-19-1-0-rename-no-extra-semi"
},
{
"cli": "nx",
"version": "20.0.0-beta.5",
"description": "replace getJestProjects with getJestProjectsAsync",
"implementation": "./src/migrations/update-20-0-0/replace-getJestProjects-with-getJestProjectsAsync",
"package": "@nx/jest",
"name": "replace-getJestProjects-with-getJestProjectsAsync"
}
]
}
42 changes: 34 additions & 8 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
{
"pluginsConfig": { "@nx/js": { "analyzeSourceFiles": true } },
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": true
}
},
"extends": "nx/presets/npm.json",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"production": [
"!{projectRoot}/test/**",
"!{projectRoot}/**/*.{spec,test}.ts",
"!{projectRoot}/node_modules/**"
"!{projectRoot}/node_modules/**",
"!{projectRoot}/eslint.config.js"
]
},
"release": {
"projects": ["packages/*"],
"projectsRelationship": "independent",
"changelog": { "projectChangelogs": { "createRelease": "github" } },
"changelog": {
"projectChangelogs": {
"createRelease": "github"
}
},
"version": {
"conventionalCommits": true,
"generatorOptions": { "skipLockFileUpdate": true }
"generatorOptions": {
"skipLockFileUpdate": true
}
},
"git": { "commit": true, "tag": true }
"git": {
"commit": true,
"tag": true
}
},
"targetDefaults": {
"build": {
Expand All @@ -28,15 +42,27 @@
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"options": { "passWithNoTests": true },
"configurations": { "ci": { "ci": true, "codeCoverage": true } }
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}",
"registry": "https://registry.npmjs.org/"
},
"dependsOn": [{ "target": "build", "params": "forward" }]
"dependsOn": [
{
"target": "build",
"params": "forward"
}
]
},
"@nx/eslint:lint": {
"cache": true,
Expand Down
Loading

0 comments on commit 9dad882

Please sign in to comment.