Skip to content

Commit

Permalink
build(node): update node version to 18 and update config of eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
sinlov committed May 2, 2024
1 parent 8bd9bdf commit 74e9e36
Show file tree
Hide file tree
Showing 29 changed files with 984 additions and 390 deletions.
47 changes: 33 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,61 @@
const process = require('process');
const stylisticEsLint = require('@stylistic/eslint-plugin');

const customizedStylistJs = stylisticEsLint.configs.customize({
// the following options are the default values
indent: 2,
quotes: 'single',
quoteProps: 'consistent',
semi: true,
jsx: true,
braceStyle: '1tbs',
});

const javascriptSettings = {
files: ['*.js'],
env: {
'browser': true,
'commonjs': true,
'es2021': true
'es2021': true,
},
extends: [
'eslint:recommended',
'plugin:jest/recommended',
],
parserOptions: {
'ecmaVersion': 12
'ecmaVersion': 12,
},
rules: {
'indent': [
'error',
2
2,
],
'linebreak-style': [
'error',
process.platform === 'win32' ? 'windows' : 'unix'
'unix',
],
'quotes': [
'error',
'single'
'single',
],
'no-else-return': ['error', {allowElseIf: false}],
'no-else-return': ['error', { allowElseIf: false }],
'no-unused-vars': ['error', { 'vars': 'all', 'args': 'after-used', 'ignoreRestSiblings': false }],
'semi': [
'error',
'always'
]
}
'always',
],
},
};

module.exports = {
plugins: ['jest'],
plugins: [
'jest',
'@stylistic',
],
rules: {
...customizedStylistJs.rules,
// ...your other rules
},
overrides: [
javascriptSettings
]
};
javascriptSettings,
],
};
75 changes: 75 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Declare files that will always have CRLF line endings on checkout.
###############################################################################
*.sln text eol=crlf
*.cs text eol=crlf
*.resx text eol=crlf
*.csproj text eol=crlf
*.user text eol=crlf
*.asset text eol=lf
*.json test eol=lf
*.js test eol=lf
*.ts test eol=lf
*.yml test eol=lf
*.yaml test eol=lf
*.vue test eol=lf
*.golden test eol=lf
*.mod test eol=lf
*.sum test eol=lf

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
*.mod merge=union
*.sum merge=union
*.lock merge=union

###############################################################################
# Denote all files that are truly binary and should not be modified.
#
# image files are treated as binary by default.
###############################################################################
*.jpg binary
*.png binary
*.gif binary
*.lib binary
*.dll binary
*.pfx binary
*.ico binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

###############################################################################
# linguist language
###############################################################################
# *.mk linguist-language=go
26 changes: 19 additions & 7 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
node-version: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- '14.x'
- 'lts/*'
- '18.x'
- '20.x'
- 'lts/*'
os:
- macos-latest
- windows-latest
Expand All @@ -30,18 +30,30 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

-
name: Install dependencies
run: npm install
run: |
node --version
npm --version
npm install
-
name: Build if present
run: npm run build --if-present

-
name: Build run help
run: npm run help
name: run style check
run: npm run format:check

-
name: run lint
run: npm run lint

-
name: Test with node
run: npm test
name: run test
run: npm run test

-
name: Test coverage
run: npm run jest:coverage
2 changes: 1 addition & 1 deletion .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: get version and conventional
id: check-version
uses: convention-change/conventional-version-check@v1.2.0 # or change to latest version
uses: convention-change/conventional-version-check@v1.4.0 # or change to latest version
with:
sha-length: 8

Expand Down
68 changes: 16 additions & 52 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### project setting

*.log
CHANGELOG.txt

### custom template

/dist/
Expand All @@ -8,6 +13,9 @@ logs
*.log
npm-debug.log*

# publish
.npmrc

# Runtime data
pids
*.pid
Expand Down Expand Up @@ -51,58 +59,15 @@ jspm_packages
# Yarn Integrity file
.yarn-integrity

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

/captures
/.idea
*.iml

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries
### IDE

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
xcuserdata/
.idea/
.vs/
.vscode/

### Linux template
*~
# *~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
Expand All @@ -112,17 +77,16 @@ fabric.properties

# Linux trash folder which might appear on any partition or disk
.Trash-*

### OSX template
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
# Icon

# Thumbnails
._*
# ._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
Expand Down
Loading

0 comments on commit 74e9e36

Please sign in to comment.