Skip to content

Commit

Permalink
Release 11.2.0 (#99)
Browse files Browse the repository at this point in the history
## What's changed

* feat: add ESLint rule for deterministic import order
([#98](#98))
* feat: enable tile graph for RS Doctor in rspack.config.js
([#97](#97))
  • Loading branch information
puehringer authored Oct 10, 2024
2 parents 33029f2 + b455897 commit f8eda97
Show file tree
Hide file tree
Showing 7 changed files with 1,483 additions and 1,399 deletions.
46 changes: 43 additions & 3 deletions config/eslintrc.template.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = ({ tsconfigRootDir }) => ({
module.exports = ({ tsconfigRootDir, optimizeImports }) => ({
root: true,
extends: [
'airbnb',
Expand All @@ -11,7 +11,7 @@ module.exports = ({ tsconfigRootDir }) => ({
'plugin:prettier/recommended',
// 'plugin:lodash/recommended',
],
plugins: ['react', '@typescript-eslint', 'react-compiler'],
plugins: ['react', '@typescript-eslint', 'react-compiler', ...(optimizeImports ? ['unused-imports'] : [])],
ignorePatterns: ['*.js'],
env: {
browser: true,
Expand Down Expand Up @@ -68,7 +68,47 @@ module.exports = ({ tsconfigRootDir }) => ({
'import/no-webpack-loader-syntax': 'off', // Disable to allow webpack file-loaders syntax
'import/no-unresolved': 'off', // Disable to allow webpack file-loaders syntax
'import/prefer-default-export': 'off',
'import/order': 'error',
...(optimizeImports ? {
'import/order': [
1,
{
groups: [['builtin', 'external'], 'internal', ['sibling', 'parent']],
pathGroups: [
{
pattern: 'react*',
group: 'external',
position: 'before',
},
{ pattern: 'src/**', group: 'internal', position: 'after' },
],
pathGroupsExcludedImportTypes: ['internal', 'react'],
'newlines-between': 'always',
alphabetize: { order: 'asc' },
},
],
'sort-imports': [
1,
{
ignoreCase: false,
ignoreDeclarationSort: true, // don't want to sort import lines, use eslint-plugin-import instead
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: true,
},
],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
} : {
'import/order': 'error',
}),
'prefer-destructuring': ['warn', { object: true, array: false }],
'prefer-promise-reject-errors': 'warn',
'prefer-spread': 'warn',
Expand Down
6 changes: 5 additions & 1 deletion config/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ module.exports = (webpackEnv, argv) => {
].filter(Boolean),
},
plugins: [
process.env.RSDOCTOR && new RsdoctorRspackPlugin(),
process.env.RSDOCTOR && new RsdoctorRspackPlugin({
supports: {
generateTileGraph: true,
},
}),
isReactRefresh && new ReactRefreshPlugin(),
new DotenvPlugin({
path: path.join(workspacePath, '.env'), // load this now instead of the ones in '.env'
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visyn_scripts",
"description": "",
"version": "11.1.2",
"version": "11.2.0",
"author": {
"name": "datavisyn GmbH",
"email": "[email protected]",
Expand Down Expand Up @@ -62,6 +62,7 @@
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-compiler": "0.0.0-experimental-b8a7b48-20240830",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^4.1.4",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"fs-extra": "^11.2.0",
"glob": "^11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests_fixtures/standalone_template/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('visyn_scripts/config/eslintrc.template')({ tsconfigRootDir: __dirname });
module.exports = require('visyn_scripts/config/eslintrc.template')({ tsconfigRootDir: __dirname, optimizeImports: true });
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import { MainApp } from './MainApp';

export default {
Expand Down
2 changes: 2 additions & 0 deletions tests_fixtures/standalone_template/src/index.initialize.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as React from 'react';

import { createRoot } from 'react-dom/client';

import { MainApp } from './app';

// create a new instance of the app
Expand Down
Loading

0 comments on commit f8eda97

Please sign in to comment.