Skip to content

Commit

Permalink
Liniting by @wordpress/scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
widoz committed Jun 17, 2023
1 parent f04beae commit b21880f
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 54 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const baseConfiguration = require('@wordpress/scripts/config/.eslintrc.js');

module.exports = {
...baseConfiguration,
settings: {
'import/resolver': {
typescript: {},
},
},
};
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const prettierConfig = require('@wordpress/scripts/config/.prettierrc.js')

module.exports = prettierConfig
28 changes: 0 additions & 28 deletions .prettierrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleDirectories: ['node_modules'],
}
preset: 'ts-jest',
testEnvironment: 'jsdom',
moduleDirectories: ['node_modules'],
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@wordpress/dependency-extraction-webpack-plugin": "^4.8.0",
"@wordpress/env": "^5.9.0",
"@wordpress/eslint-plugin": "^14.8.0",
"@wordpress/scripts": "^25.1.0",
"eslint-import-resolver-typescript": "^3.5.5",
"jest": "^29.4.3",
"prettier": "^2.8.1",
"ts-jest": "^29.0.5",
Expand All @@ -39,6 +41,8 @@
"build": "wp-scripts build --webpack-src-dir=./sources/js/src",
"build:dev": "wp-scripts build --mode=development --webpack-src-dir=./sources/js/src",
"cs:fix": "wp-scripts format ./sources/js",
"lint:js": "wp-scripts lint-js",
"lint:js:fix": "wp-scripts lint-js --fix",
"test": "jest"
}
}
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
"esModuleInterop": true,
"baseUrl": ".",
"paths": {
"@entities-search-types": [
"./sources/js/src/@types"
],
"@entities-search": [
"./sources/js/src"
],
]
},
},
"include": [
Expand Down
43 changes: 24 additions & 19 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
const path = require('path')
const baseConfiguration = require('@wordpress/scripts/config/webpack.config')
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin')
const path = require('path');
const baseConfiguration = require('@wordpress/scripts/config/webpack.config');
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin');

module.exports = {
...baseConfiguration,
plugins: [
...baseConfiguration.plugins.filter(
plugin => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
),
new DependencyExtractionWebpackPlugin({
outputFormat: 'json',
}),
],
resolve: {
extensions: ['.ts', '.tsx'],
alias: {
'@entities-search': path.resolve(__dirname, 'sources/js/src'),
},
},
}
...baseConfiguration,
plugins: [
...baseConfiguration.plugins.filter(
(plugin) =>
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
),
new DependencyExtractionWebpackPlugin({
outputFormat: 'json',
}),
],
resolve: {
extensions: ['.ts', '.tsx'],
alias: {
'@entities-search': path.resolve(__dirname, 'sources/js/src'),
'@entities-search-types': path.resolve(
__dirname,
'sources/js/src/@types'
),
},
},
};
Loading

0 comments on commit b21880f

Please sign in to comment.