Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-rule-schemata

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-rule-schemata - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

eslint/3.18.0/rules/accessor-pairs-pretty.json

28

generate.js
const fs = require('fs');
const path = require('path');
const reduce = require('lodash.reduce');
const forEach = require('lodash.foreach');
const loadRules = require('eslint/lib/load-rules');
const baseSchema = require('./schema.json');

@@ -9,22 +11,20 @@ const packages = [

];
const toJSON = data => JSON.stringify(data, null, 2);
const toPrettyJSON = data => JSON.stringify(data, null, 2);
packages.forEach(package => {
const version = require(`${package}/package.json`).version;
const rules = loadRules(`node_modules/${package}/lib/rules`, __dirname);
const definitions = reduce(rules, (defs, filepath, name) => {
const rule = require(filepath);
const schemata = rule.meta.schema;
defs[name] = rule.meta.schema;
return defs;
}, {});
const dir = path.join(__dirname, package, version, 'rules');
const dir = path.join(__dirname, package, version);
try {
fs.mkdirSync(dir);
} catch(err) { }
fs.mkdirSync(dir);
} catch (err) { }
fs.writeFileSync(path.join(dir, 'schema.json'), toJSON(definitions));
const rules = loadRules(`node_modules/${package}/lib/rules`, __dirname);
forEach(rules, (filepath, name) => {
const rule = require(filepath);
const schema = rule.meta.schema;
fs.writeFileSync(path.join(dir, `${name}.json`), JSON.stringify(schema));
fs.writeFileSync(path.join(dir, `${name}-pretty.json`), toPrettyJSON(schema));
});
});
{
"name": "eslint-rule-schemata",
"version": "0.0.3",
"version": "0.1.0",
"description": "JSON Schema for ESLint rules",

@@ -23,3 +23,4 @@ "main": "index.js",

"devDependencies": {
"eslint": "3.9.0",
"eslint": "3.18.0 ",
"lodash.foreach": "^4.5.0",
"lodash.reduce": "^4.6.0",

@@ -26,0 +27,0 @@ "yamljs": "^0.2.8"

{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",

@@ -21,7 +22,10 @@ "definitions": {

"ecmaVersion": {
"description": "set to 3, 5 (default), 6, 7, or 8 to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), or 2017 (same as 8) to use the year-based naming.",
"type": "number",
"enum": [
3,
5,
6,
7,
8,
2015,

@@ -34,2 +38,3 @@ 2016,

"sourceType": {
"description": "set to \"script\" (default) or \"module\" if your code is in ECMAScript modules.",
"type": "string",

@@ -43,14 +48,19 @@ "enum": [

"ecmaFeatures": {
"description": "an object indicating which additional language features you’d like to use",
"type": "object",
"properties": {
"globalReturn": {
"description": "allow return statements in the global scope",
"type": "bool"
},
"impliedStrict": {
"description": "enable global strict mode (if ecmaVersion is 5 or greater)",
"type": "bool"
},
"jsx": {
"description": "enable JSX",
"type": "bool"
},
"experimentalObjectRestSpread": {
"description": "enable support for the experimental object rest/spread properties (IMPORTANT: This is an experimental feature that may change significantly in the future. It’s recommended that you do not write rules relying on this functionality unless you are willing to incur maintenance cost when it changes.)",
"type": "bool"

@@ -202,2 +212,12 @@ }

"additionalProperties": true
},
"ruleFlag": {
"enum": [
0,
1,
2,
"off",
"warn",
"error"
]
}

@@ -221,6 +241,9 @@ },

},
"rules": {
"$ref": "#/definitions/rules"
"plugins": {
"$ref": "#/definitions/plugins"
},
"globals": {
"$ref": "#/definitions/globals"
}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc