lint-svn
Place config file in your root directory of names `.lintsvnrc.js` or `lint-svn.config.js`, which has the following content
Last updated 3 months ago by foresightyj .
ISC · Original npm · Tarball · package.json
$ cnpm install lint-svn 
SYNC missed versions from official npm registry.

Note

Svn itself doesn't have a concept of client-side hooks. It only had server side hooks. But it is made possible by TortoiseSVN.

Installation

npm install --save-dev lint-svn

Configuration

Create a config file in your root directory of name: .lintsvnrc.js or lint-svn.config.js, which has the following content

//@ts-check

/**
 * @param {string[]} files
 */
async function checkunversioned(files) {
    const warnings = [];
    for (const file of files) {
        if(path.extname(file) === ".png")
            warnings.push(
                new Warning(`Please remember to add images to svn`, "High"),
            );
        }
    }
    return warnings;
}

/** @type {LintConfig} */
const lintConfig = {
    ignoreExts:[".dll", ".map"],
    concurrency: 5,
    rules: [
        {
            glob: "src/**/*.(ts|tsx|scss|json)",
            command: ["prettier --write"],
        },
        {
            glob: "src/**/*.(ts|tsx)",
            command: ["eslint --fix"],
        },
        {
            glob: "*",
            //if false, only lint added & modified files
            nonVersioned: true,
            command: checkunversioned,
        },
    ],
};

Then run npx lint-svn to see the effect.

Configure TortoiseSvn Client-Side Hook

First read: Client Side Hook Scripts

You still needed a bootstrap script for TortoiseSVN to call and pass command line args to. For me, I had a script called preCommitHook.js with content like:

//@ts-check

// ToritoiseSVN calls your script with these args:
// D:\MyProject\preCommitHook.js, C:\Users\ADMINI~1\AppData\Local\Temp\svnC121.tmp, 3, C:\Users\ADMINI~1\AppData\Local\Temp\svnC122.tmp, D:\Working\MyProject\src\pages\base

const $ = require("shelljs");
const res = $.exec("npm run lint-svn");
if(res.code){
    console.error(res.stderr);
    process.exit(res.code)
}

Right click the project folder -> TortoiseSVN -> Properties, and add a property:

tsvn:precommithook: node %REPOROOT%/trunk/MyProject/preCommitHook.js

Current Tags

  • 1.0.14                                ...           latest (17 days ago)

14 Versions

  • 1.0.14                                ...           17 days ago
  • 1.0.13                                ...           3 months ago
  • 1.0.12                                ...           3 months ago
  • 1.0.11                                ...           3 months ago
  • 1.0.10                                ...           3 months ago
  • 1.0.9                                ...           3 months ago
  • 1.0.8                                ...           3 months ago
  • 1.0.6                                ...           3 months ago
  • 1.0.5                                ...           3 months ago
  • 1.0.4                                ...           3 months ago
  • 1.0.3                                ...           3 months ago
  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           3 months ago
  • 1.0.0                                ...           3 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 11
Dependencies (8)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |