├── .gitattributes ├── .gitignore ├── action.yml ├── .github ├── eslint-stylish.json └── FUNDING.yml ├── src └── main.ts ├── tsconfig.json ├── package.json ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Packages 2 | node_modules/ 3 | dist/ 4 | 5 | # Log files 6 | logs/ 7 | *.log 8 | npm-debug.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | 15 | # Miscellaneous 16 | .tmp/ 17 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'ESLint (JS/TS) Action ' 2 | description: 'Lints JavaScript/TypeScript code.' 3 | author: 'iCrawl' 4 | branding: 5 | icon: check-circle 6 | color: yellow 7 | inputs: 8 | custom-glob: 9 | description: 'Custom glob to overwrite which files to lint.' 10 | required: false 11 | default: 'src' 12 | runs: 13 | using: 'node12' 14 | main: 'dist/index.js' 15 | -------------------------------------------------------------------------------- /.github/eslint-stylish.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "eslint-stylish", 5 | "pattern": [ 6 | { 7 | "regexp": "^([^\\s].*)$", 8 | "file": 1 9 | }, 10 | { 11 | "regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$", 12 | "line": 1, 13 | "column": 2, 14 | "severity": 3, 15 | "message": 4, 16 | "code": 5, 17 | "loop": true 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { exec } from '@actions/exec'; 3 | import { getInput, setFailed } from '@actions/core'; 4 | 5 | async function run() { 6 | try { 7 | const customGlob = getInput('custom-glob'); 8 | console.log(`##[add-matcher]${join(__dirname, '..', '.github', 'eslint-stylish.json')}`); 9 | const args = [`${join(process.cwd(), 'node_modules/eslint/bin/eslint')}`, '--ext', 'js,jsx,ts,tsx', customGlob]; 10 | await exec('node', args); 11 | } catch { 12 | setFailed(''); 13 | } 14 | } 15 | 16 | void run(); 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "moduleResolution": "node", 5 | "module": "esnext", 6 | "target": "es2019", 7 | "lib": [ 8 | "esnext", 9 | "esnext.array", 10 | "esnext.asynciterable", 11 | "esnext.intl", 12 | "esnext.symbol" 13 | ], 14 | "sourceMap": false, 15 | "inlineSourceMap": true, 16 | "inlineSources": true, 17 | "sourceRoot": "src", 18 | "outDir": "dist", 19 | "declaration": false, 20 | "removeComments": false, 21 | "alwaysStrict": true, 22 | "allowSyntheticDefaultImports": true, 23 | "pretty": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [icrawl] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: iCrawl 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: crawltogo 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "action-eslint", 3 | "version": "1.0.0", 4 | "description": "TypeScript/JavaScript ESLint action", 5 | "main": "dist/index.js", 6 | "author": "iCrawl ", 7 | "license": "MIT", 8 | "private": true, 9 | "scripts": { 10 | "prebuild": "npm run lint", 11 | "build": "ncc build src/main.ts --minify", 12 | "lint": "eslint src --ext .ts", 13 | "lint:fix": "eslint src --ext .ts --fix" 14 | }, 15 | "dependencies": { 16 | "@actions/core": "^1.2.6", 17 | "@actions/exec": "^1.0.4" 18 | }, 19 | "devDependencies": { 20 | "@types/eslint": "^7.2.6", 21 | "@types/node": "^14.14.11", 22 | "@typescript-eslint/eslint-plugin": "^4.0.0", 23 | "@typescript-eslint/parser": "^3.10.1", 24 | "@zeit/ncc": "^0.22.3", 25 | "eslint": "^7.15.0", 26 | "eslint-config-marine": "^7.2.0", 27 | "eslint-config-prettier": "^7.0.0", 28 | "eslint-plugin-prettier": "^3.2.0", 29 | "prettier": "^2.2.1", 30 | "typescript": "^4.1.2" 31 | }, 32 | "eslintConfig": { 33 | "extends": "marine/prettier/node" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 iCrawl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # action-eslint 2 | > TypeScript/JavaScript ESLint [action](https://github.com/features/actions) 3 | 4 | ## Usage 5 | 6 | `.github/workflows/lint.yml` 7 | ```yml 8 | on: 9 | push: 10 | pull_request: 11 | 12 | jobs: 13 | eslint: 14 | name: eslint 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: install node v12 19 | uses: actions/setup-node@v1 20 | with: 21 | node-version: 12 22 | - name: yarn install 23 | run: yarn install 24 | - name: eslint 25 | uses: icrawl/action-eslint@v1 26 | with: 27 | custom-glob: apps # only if a different glob is needed, default: src 28 | ``` 29 | 30 | ## Contributing 31 | 32 | 1. Fork it! 33 | 2. Create your feature branch: `git checkout -b my-new-feature` 34 | 3. Commit your changes: `git commit -am 'Add some feature'` 35 | 4. Push to the branch: `git push origin my-new-feature` 36 | 5. Submit a pull request :D 37 | 38 | ## Author 39 | 40 | **action-eslint** © [iCrawl](https://github.com/iCrawl) 41 | Authored and maintained by iCrawl. 42 | 43 | > GitHub [@iCrawl](https://github.com/iCrawl) · Twitter [@iCrawlToGo](https://twitter.com/iCrawlToGo) 44 | --------------------------------------------------------------------------------