Skip to content

Commit

Permalink
650 refactor imports (extension template) (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfheij-sil authored Dec 7, 2023
2 parents 70bed53 + 394101a commit 9c9ac90
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ module.exports = {
'no-console': 'warn',
'no-null/no-null': 2,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['shared/*', 'renderer/*', 'extension-host/*', 'node/*', 'client/*', 'main/*'],
message: `Importing from this path is not allowed. Try importing from @papi/core. Imports from paths like 'shared', 'renderer', 'node', 'client' and 'main' are not allowed to prevent unnecessary import break.`,
},
],
},
],
'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }],
'react/jsx-indent-props': ['warn', 2],
'react/jsx-props-no-spreading': ['error', { custom: 'ignore' }],
Expand All @@ -81,7 +92,7 @@ module.exports = {

// #region Overrides from paranext-core extension .eslintrc.cjs

'import/no-unresolved': ['error', { ignore: ['papi'] }],
'import/no-unresolved': ['error', { ignore: ['@papi'] }],

// #endregion
},
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from 'papi-backend';
import { logger } from '@papi/backend';

export async function activate() {
logger.info('Extension template is activating!');
Expand Down
7 changes: 4 additions & 3 deletions webpack/webpack.config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ const configBase: webpack.Configuration = {
'react/jsx-runtime',
'react-dom',
'react-dom/client',
'papi-frontend',
'papi-frontend/react',
'papi-backend',
'@papi/backend',
'@papi/core',
'@papi/frontend',
'@papi/frontend/react',
'@sillsdev/scripture',
],
module: {
Expand Down

0 comments on commit 9c9ac90

Please sign in to comment.