Skip to content

Commit

Permalink
Migrate eslint configuration to flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
elchininet committed Apr 8, 2024
1 parent dca598e commit e613eeb
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 112 deletions.
49 changes: 0 additions & 49 deletions .eslintrc.js

This file was deleted.

49 changes: 49 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const tseslint = require('typescript-eslint');
const js = require('@eslint/js');
const globals = require('globals');

module.exports = [
{
languageOptions: {
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
...globals.browser,
...globals.node,
...globals.es2018
}
}
},
js.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
quotes: [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
indent: ['error', 4, { SwitchCase: 1 }],
semi: ['error', 'always'],
'no-trailing-spaces': ['error'],
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'off'
}
},
{
files: ['src/@utils/other.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
},
{
files: ['tests/*.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off'
}
}
];
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"demo": "webpack serve --open --config webpack.demo.config.js",
"docs": "webpack --config webpack.demo.publish.js --mode production",
"test:ts": "tsc --noEmit",
"test:lint": "eslint src/**/* tests/*.ts demo/**/*.js --ext .ts,.js",
"test:lint": "eslint src/**/* tests/*.ts demo/**/*.js",
"test:unit": "jest --verbose",
"test:all": "pnpm test:ts && pnpm test:lint && pnpm test:unit",
"preinstall": "npx -y only-allow pnpm",
Expand Down Expand Up @@ -77,12 +77,11 @@
"@rollup/plugin-terser": "^0.4.4",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.5",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.0.0",
"eslint": "^9.0.0",
"globals": "^15.0.0",
"google-code-prettify": "^1.0.5",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
Expand All @@ -98,6 +97,7 @@
"ts-loader": "^9.5.1",
"tslib": "^2.6.2",
"typescript": "^5.4.4",
"typescript-eslint": "^7.6.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
Expand Down
115 changes: 66 additions & 49 deletions pnpm-lock.yaml

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

7 changes: 3 additions & 4 deletions src/@utils/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ const multiplyMatrix = (m1: Matrix, m2: Matrix): Matrix => (
m1.map((row, i): number[] => (
m2[0].map((_: number, j: number): number =>
row.reduce((acc: number, _: number, n: number): number =>
acc + m1[i][n] * m2[n][j],
0
acc + m1[i][n] * m2[n][j], 0
)
)
)
));
))
);

const multiplyMatrices = (...m: Matrix[]): Matrix => {
let matrix = m[0];
Expand Down
Loading

0 comments on commit e613eeb

Please sign in to comment.