Permalink
Browse files

add javascript specific styles

  • Loading branch information...
1 parent 91fbc03 commit b1bead8e4c3c6ab903891e8a4dab1727bfcb9121 @jesseweed committed Mar 23, 2016
Showing with 152 additions and 60 deletions.
  1. +21 −39 .jshintrc
  2. +1 −0 index.less
  3. +123 −21 sample-files/JavaScript.js
  4. +7 −0 styles/languages/javascript.less
View
@@ -1,41 +1,23 @@
{
- "node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
- "browser": true, // Standard browser globals e.g. `window`, `document`.
- "es5": true, // Allow EcmaScript 5 syntax.
- "esnext": true, // Allow ES.next specific features such as `const` and `let`.
- "bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
- "camelcase": false, // Permit only camelcase for `var` and `object indexes`.
- "curly": false, // Require {} for every new block or scope.
- "eqeqeq": true, // Require triple equals i.e. `===`.
- "immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
- "latedef": true, // Prohibit variable use before definition.
- "newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
- "noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
- "quotmark": "single", // Define quotes to string values.
- "regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
- "undef": true, // Require all non-global variables be declared before they are used.
- "unused": false, // Warn unused variables.
- "strict": false, // Require `use strict` pragma in every file.
- "trailing": true, // Prohibit trailing whitespaces.
- "smarttabs": false, // Suppresses warnings about mixed tabs and spaces
- "predef": [ // Extra globals.
- "Backbone",
- "define",
- "require",
- "exports",
- "module",
- "Marionette",
- "describe",
- "before",
- "beforeEach",
- "after",
- "afterEach",
- "it",
- "$",
- "jQuery"
- ],
- "indent": 2, // Specify indentation spacing
- "maxlen": 240, // Max line lenght
- "devel": false, // Allow development statements e.g. `console.log();`.
- "noempty": true // Prohibit use of empty blocks.
+ "node": true,
+ "browser": true,
+ "esnext": true,
+ "bitwise": false,
+ "camelcase": false,
+ "curly": false,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": false,
+ "strict": false,
+ "trailing": true,
+ "smarttabs": false,
+ "indent": 2,
+ "devel": false,
+ "noempty": true
}
View
@@ -5,6 +5,7 @@
// Language specific styles
@import "./styles/languages/html.less";
@import "./styles/languages/jade.less";
+@import "./styles/languages/javascript.less";
@import "./styles/languages/json.less";
@import "./styles/languages/mustache.less";
@import "./styles/languages/go.less";
@@ -1,28 +1,130 @@
-var koa = require('koa');
-var app = koa();
+/*
-// x-response-time
+ HIGHLIGHTING: https://github.com/atom/language-javascript/blob/master/grammars/javascript.cson
+ FILE TYPES: 'js', 'htc', '_js', 'es', 'es6', 'jsm', 'pac', 'pjs', 'xsjs', 'xsjslib'
+ WRAPPER: source.js
-app.use(function *(next){
- var start = new Date();
- yield next;
- var ms = new Date() - start;
- this.set('X-Response-Time', ms + 'ms');
-});
+*/
-// logger
-app.use(function *(next){
- var start = new Date();
- yield next;
- var ms = new Date() - start;
- console.log('%s %s - %s', this.method, this.url, ms);
-});
+/*
-// response
+ COMMENTS
+ --------
+ CLASS: punctuation.definition.comment.js
+ TRIGGERS: js single line or comment blocks
-app.use(function *(){
- this.body = 'Hello World';
-});
+*/
-app.listen(3000);
+
+
+/*
+
+ DOCBLOCK
+ --------
+ CLASS: storage.type.class.jsdoc
+
+ TRIGGERS: abstract, access, alias, augments, author, async, attribute, arg, argument, beta, borrows, bubbes, callback, class, classdesc, config, const, constant, constructs, constructor, copyright, chainable, default, defaultvalue, deprecated, desc, description, enum, emits, event, example, exports, external, extends, extension, extensionfor, extension_for, for, file, fileoverview, fires, final, function, global, host, ignore, implements, inheritdoc, inner, instance, interface, kind, lends, license, listens, main, member, memberof, method, mixex, mixin(?:s, ), module, name, namespace, override, overview, param, private, prop, property, protected, readonly, readOnly, requires, required, return, returns, see, since, static, summary, submodule, this, throws, todo, tutorial, type, typedef, var, variation, version, virtual, uses, writeOnce
+
+*/
+
+class Bread {
+
+ constructor(slices) {
+ this.slices = 12;
+
+ if ( slices > this.slices ) {
+ return 'not enough bread';
+ } else {
+ return slices;
+ }
+
+ }
+
+}
+
+class Sandwhich extends Bread {
+
+ constructor(slices) {
+ this.bread = super(slices);
+ this.toppings = [];
+ }
+
+ toppings( ingredients ) {
+ ingredients.forEach(function(value, index) {
+ this.toppings.push( value );
+ });
+ }
+
+}
+
+var Club = new Sandwhich(3).toppings(['roast beef', 'turkey']);
+
+
+/*
+
+ INTERPOLATED JS
+ --------
+ CLASS: punctuation.definition.comment.js
+ TRIGGERS: punctuation.section.embedded.js
+ NOTE: This class doesn't currently seem to actually get applied
+
+*/
+
+ var myName = 'Slim Shady',
+ template = 'Hello, my name is ${myName}';
+
+
+
+/*
+
+ FUNCTION PARAMS
+ --------
+ TRIGGER: () CLASS: meta.brace.round.js
+ TRIGGER: [] CLASS: meta.brace.square.js
+ TRIGGER: {} CLASS: meta.brace.curly.js
+ TRIGGER: , CLASS: meta.object.delimiter.js
+ TRIGGER: = CLASS: keyword.operator.js
+ TRIGGER: parameters CLASS: variable.parameter.function.js
+
+*/
+
+
+function testFunction(string,arr,obj) {
+// DO SOMETHING
+}
+
+testFunction('one', 'two', [1,2,3], {key: 'value'} );
+
+
+/*
+
+ METHODS
+ --------
+ WRAPPER: meta.method.js
+
+ TRIGGER: break, case, catch, continue, do, else, export, finally, for, function, if, import, package, return, switch, throw, try, while, with
+
+*/
+
+import { ham as turkey } from 'mySandwhich.js';
+
+var isFunction;
+
+switch ( typeof testFunction ) {
+
+ case 'function':
+ isFunction = true;
+ break;
+ default:
+ isFunction = false;
+
+}
+
+try {
+ testFunction();
+} catch (e) {
+ throw 'Whoopsadaisy!';
+} finally {
+ console.log('i think we\'re done here!');
+}
@@ -0,0 +1,7 @@
+.source.js {
+
+ .punctuation.section.embedded.js {
+ color: pink;
+ }
+
+}

0 comments on commit b1bead8

Please sign in to comment.