Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for use in multi-extension-template #55

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ max_line_length = 100

[*.md]
trim_trailing_whitespace = false

[*.cs]
indent_size = 4
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm-debug.log.*
*.sass.d.ts
*.scss.d.ts

# Packager output
# Built files
dist
release
temp-build
Expand Down
42 changes: 26 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ module.exports = {
// https://github.com/electron-react-boilerplate/eslint-config-erb/blob/main/index.js
// airbnb rules are embedded in erb https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
'erb',
// Make sure this is last so it gets the chance to override other configs.
// See https://github.com/prettier/eslint-config-prettier and https://github.com/prettier/eslint-plugin-prettier
'plugin:prettier/recommended',
],

rules: {
// #region From paranext-core root .eslintrc.js
// Some rules are commented out since they have overrides in the
// 'Overrides from paranext-core extension .eslintrc.cjs' section
// Some rules are commented out since they have overrides in following sections

// #region ERB rules

Expand All @@ -22,7 +24,7 @@ module.exports = {

// #endregion

// #region Paranext rules
// #region Platform.Bible rules

// Rules in each section are generally in alphabetical order. However, several
// `@typescript-eslint` rules require disabling the equivalent ESLint rule. So in these cases
Expand All @@ -47,6 +49,17 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'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.`,
},
],
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-use-before-define': 'off',
Expand All @@ -70,17 +83,7 @@ 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.`,
},
],
},
],
'no-type-assertion/no-type-assertion': 'error',
'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }],
'react/jsx-indent-props': ['warn', 2],
'react/jsx-props-no-spreading': ['error', { custom: 'ignore' }],
Expand All @@ -90,7 +93,7 @@ module.exports = {

// #endregion

// #region Overrides from paranext-core extension .eslintrc.cjs
// #region Overrides shared with paranext-multi-extension-template .eslintrc.cjs

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

Expand All @@ -113,6 +116,13 @@ module.exports = {
'import/prefer-default-export': 'off',
},
},
{
files: ['./lib/*', './webpack/*'],
rules: {
// These files are scripts not running in Platform.Bible, so they can't use the logger
'no-console': 'off',
},
},
],
parserOptions: {
ecmaVersion: 2020,
Expand All @@ -121,7 +131,7 @@ module.exports = {
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
plugins: ['@typescript-eslint', 'no-null'],
plugins: ['@typescript-eslint', 'no-type-assertion', 'no-null'],
settings: {
'import/resolver': {
typescript: {
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm-debug.log.*
*.sass.d.ts
*.scss.d.ts

# Packager output
# Built files
dist
release
temp-build
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module.exports = {
trailingComma: 'all',
endOfLine: 'lf',
singleQuote: true,
// prettier-plugin-jsdoc options
tsdoc: true,
plugins: ['prettier-plugin-jsdoc'],
overrides: [
{
files: '*.json',
Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm-debug.log.*
*.sass.d.ts
*.scss.d.ts

# Packager output
# Built files
dist
release
temp-build
Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"stylelint.vscode-stylelint"
]
}
32 changes: 23 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.rulers": [100],
"editor.wordWrapColumn": 100,

"eslint.validate": ["javascript", "javascriptreact", "html", "typescriptreact"],

"files.associations": {
".eslintignore": "ignore",
".prettierignore": "ignore",
".stylelintignore": "ignore"
},
"files.eol": "\n",
"cSpell.words": [
"asyncs",
"endregion",
"papi",
"paranext",
"sillsdev",
"unsub",
"unsubscriber",
"usfm"

"javascript.validate.enable": false,
"javascript.format.enable": false,
"typescript.format.enable": false,

"search.exclude": {
".git": true,
".eslintcache": true,
"node_modules": true,
"npm-debug.log.*": true,
"package-lock.json": true,
"*.{css,sass,scss}.d.ts": true
},

"json.schemas": [
{
"fileMatch": ["*tsconfig*.json"],
"url": "http://json.schemastore.org/tsconfig"
}
],

"todohighlight.keywords": [
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Paranext
Copyright (c) <year> <copyright_holder_name>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading