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

chore: added ci lints and script to update dependencies and format code #715

Merged
merged 1 commit into from
Oct 4, 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
4 changes: 2 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ rules:
- error
- 300
max-lines-per-function:
- error
- warn
- max: 20
no-console: error
no-duplicate-imports: error
Expand All @@ -100,7 +100,7 @@ rules:
- .js
- .jsx
react/prop-types: error
sort-imports: error
sort-imports: warn
sort-keys:
- error
- asc
Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ on: [push, pull_request]

jobs:
# TODO: check project builds/compiles correctly, maybe with tsc TypeScript compiler?

# TODO: add tests including coverage

lint_files:
lint_src_files:
name: Lint source files
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -41,7 +40,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -65,7 +64,7 @@ jobs:
name: Search for TODOs etc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Search for TODO, FIXME, and BUG statements in source files
run: >
if grep
Expand All @@ -84,9 +83,8 @@ jobs:
typos_spell_check:
name: Check spelling with typos
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check spelling with typos
uses: crate-ci/typos@master
with:
Expand All @@ -95,22 +93,35 @@ jobs:
lint_markdown_files:
name: Lint Markdown files
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: articulate/actions-markdownlint@v1
with:
files: '*.md'
ignore: '**/node_modules'

lint_yaml_files:
name: Lint YAML files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ibiqlik/action-yamllint@v3

lint_shell_script_files:
name: Lint shell scripts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azohra/shell-linter@latest

commitlint:
name: Enforce Conventional Commits
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check the commits conform to the Conventional Commits specification with commitlint
uses: wagoid/commitlint-github-action@v5

# TODO: check commits squashed into one (i.e. all changes in a PR are in one commit after last one in primary branch)
# TODO: use release-please to increment version number, update changelog, and publish releases automatically if CI passes
# TODO: use semver to increase version numbers and update changelog automatically
# TODO: publish new release automatically if version increased and CI passes (use release-please?)
1 change: 1 addition & 0 deletions examples/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { JSX } from 'react';

Check failure on line 1 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Missing @file
import { StyleSheet, Text, View } from 'react-native';
import DropDownPicker, { ItemType } from 'react-native-dropdown-picker';

Check warning on line 3 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Imports should be sorted alphabetically

Check failure on line 3 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Unable to resolve path to module 'react-native-dropdown-picker'
import JavascriptClassExample from './example-src-files/javascript-class-example';
import JavascriptFunctionExample from './example-src-files/javascript-function-example';
import TypescriptClassExample from './example-src-files/typescript-class-example';
import TypescriptFunctionExample from './example-src-files/typescript-function-example';

enum ExampleComponent {

Check failure on line 9 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

'ExampleComponent' is already declared in the upper scope on line 9 column 6
JavaScriptClassSingleValue,
JavaScriptClassMultiValue,
JavaScriptFunctionSingleValue,
Expand Down Expand Up @@ -66,6 +66,7 @@
];

type Props = Record<string, never>;

interface State {
currentExample: ExampleComponent;
examplePickerOpen: boolean;
Expand All @@ -85,7 +86,7 @@
this.setCurrentExample = this.setCurrentExample.bind(this);
}

private static getExample(egComponent: ExampleComponent): JSX.Element {

Check warning on line 89 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Static method 'getExample' has too many lines (25). Maximum allowed is 20
switch (egComponent) {
case ExampleComponent.JavaScriptClassSingleValue:
return <JavascriptClassExample multiple={false} />;
Expand Down Expand Up @@ -125,17 +126,17 @@

// todo: fix picker items being under text

render(): JSX.Element {

Check warning on line 129 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Method 'render' has too many lines (31). Maximum allowed is 20
const { currentExample, examplePickerOpen, exampleComponents } = this.state;

return (
<View style={styles.container}>
<View style={{ flex: 1 }}>

Check warning on line 134 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Inline style: { flex: 1 }
<View style={{ flex: 1 }}>

Check warning on line 135 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Inline style: { flex: 1 }
<Text>Choose example:</Text>
</View>

<View style={{ flex: 1 }}>

Check warning on line 139 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Inline style: { flex: 1 }
<DropDownPicker
setValue={this.setCurrentExample}
value={currentExample}
Expand All @@ -146,8 +147,8 @@
</View>
</View>

<View style={{ flex: 3 }}>

Check warning on line 150 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Inline style: { flex: 3 }
<View style={{ flex: 1 }}>

Check warning on line 151 in examples/App.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Inline style: { flex: 1 }
<Text>Example:</Text>
</View>

Expand Down
1 change: 1 addition & 0 deletions examples/example-src-files/typescript-class-example.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { Component } from 'react';

Check failure on line 1 in examples/example-src-files/typescript-class-example.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Missing @file
import { Button, Text, View } from 'react-native';

Check warning on line 2 in examples/example-src-files/typescript-class-example.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Imports should be sorted alphabetically
import DropDownPicker, { ItemType } from 'react-native-dropdown-picker';

Check failure on line 3 in examples/example-src-files/typescript-class-example.tsx

View workflow job for this annotation

GitHub Actions / Lint source files

Unable to resolve path to module 'react-native-dropdown-picker'

interface Props {
multiple: boolean;
}

interface State {
open: boolean;
singleValue: string | null;
Expand Down
89 changes: 43 additions & 46 deletions examples/package-lock.json

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

4 changes: 2 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
},
"dependencies": {
"expo": "^49.0.13",
"expo-status-bar": "~1.7.1",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.5",
"react-native-dropdown-picker": "^5.4.6"
},
"devDependencies": {
"@babel/core": "^7.23.0",
"@types/react": "~18.2.24",
"@types/react": "~18.2.25",
"typescript": "^5.2.2"
}
}
Loading
Loading