Skip to content

Commit

Permalink
Merge pull request #137 from osstotalsoft/feature/upgrade-eslint-config
Browse files Browse the repository at this point in the history
upgrade eslint config file
  • Loading branch information
alexandra-c authored Nov 8, 2024
2 parents 4f854d0 + 9ccfa31 commit 932c435
Show file tree
Hide file tree
Showing 37 changed files with 575 additions and 171 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

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

This file was deleted.

3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ tsconfig.build.json
__tests__
__mocks__
.babelrc
.eslintignore
.eslintrc.json
eslint.config.mjs
.gitignore
.yarn
.vscode
Expand Down
2 changes: 1 addition & 1 deletion .storybook/DocsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const useStyles = makeStyles()({
toc: {
flexBasis: '200px',
flexShrink: 0,
[`@media screen and (max-width: 1300px)`]: {
['@media screen and (max-width: 1300px)']: {
display: 'none'
}
},
Expand Down
4 changes: 2 additions & 2 deletions .storybook/TableOfContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useTocStyles = makeStyles()({
marginLeft: '40px',
flexBasis: '200px',
flexShrink: 0,
[`@media screen and (max-width: 1300px)`]: {
['@media screen and (max-width: 1300px)']: {
display: 'none'
}
},
Expand Down Expand Up @@ -111,7 +111,7 @@ export function TableOfContent({ stories }) {
<a
href={`#${name}`}
target="_self"
onClick={e => {
onClick={_e => {
isNavigating.current = true
addons.getChannel().emit(NAVIGATE_URL, `#${name}`)
setSelected(name)
Expand Down
22 changes: 11 additions & 11 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { dirname, join } from "path";
import { dirname, join } from 'path'
import type { StorybookConfig } from '@storybook/react-webpack5'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-interactions"),
getAbsolutePath("@storybook/preview-api"),
getAbsolutePath("@storybook/addon-webpack5-compiler-swc"),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@storybook/preview-api'),
getAbsolutePath('@storybook/addon-webpack5-compiler-swc')
],
staticDirs: ['../public'],
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
options: {}
},
core:{
builder:"@storybook/builder-webpack5"
core: {
builder: getAbsolutePath('@storybook/builder-webpack5')
},
typescript: {
reactDocgen: 'react-docgen',
Expand All @@ -26,10 +26,10 @@ const config: StorybookConfig = {
webpackFinal: async (config: any) => {
config.resolve.plugins = [new TsconfigPathsPlugin()]
return config
},
}
}
export default config

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
return dirname(require.resolve(join(value, 'package.json')))
}
28 changes: 4 additions & 24 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,16 @@
"**/.yarn": true,
"**/.pnp.*": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.eol": "\n",
"eslint.enable": true,
"eslint.validate": [
"typescript",
"javascript"
],
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.nodePath": ".yarn/sdks",
"typescript.validate.enable": true,
"eslint.nodePath": ".yarn/sdks/eslint",
"eslint.useFlatConfig": true,
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.tsserver.log": "verbose",
"npm.packageManager": "yarn",
"cSpell.words": [
"autodocs",
"copyfiles",
"rsbuild",
"storybuild",
"Toastify",
"Totalsoft",
"uuidv"
],
"cSpell.words": ["autodocs", "copyfiles", "rsbuild", "storybuild", "Toastify", "Totalsoft", "uuidv"],
"licenser.license": "Custom",
"licenser.author": "TotalSoft",
"licenser.customHeader": "Copyright (c) @AUTHOR@.\nThis source code is licensed under the MIT license."
Expand Down
16 changes: 14 additions & 2 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`));
16 changes: 14 additions & 2 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
module.exports = wrapWithUserWrapper(absRequire(`eslint`));
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/lib/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint`));
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/lib/types/rules/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/rules
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint/rules your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint/rules`));
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/lib/types/universal.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/universal
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint/universal your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint/universal`));
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/lib/types/use-at-your-own-risk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint/use-at-your-own-risk`));
Loading

0 comments on commit 932c435

Please sign in to comment.